php - Smarty 未定义索引变量
问题描述
我是 smarty 的新手,并试图在从 php 获取的 tpl 文件中输出一些结果。在我的account.php
文件中,我放了下面的代码
<?php
include SMARTYLOADER;
$ad2 = $db->fetchRow("SELECT * FROM ip_ptc");
$smarty->assign("ad2", $ad2);
$smarty->display("account.tpl");
$db->close();
exit();
?>
在我的account.tpl
文件中我写了下面的代码来获取结果
{$ad2.country}
但它显示了一个未定义的索引变量ad2
我在做什么错
解决方案
推荐阅读
- python - Python - 从同一个函数调用中获得不同的结果
- filepond - 使用 FilePond 我的隐藏输入值 =“未定义”和 JSON 响应
- node.js - 如何在 cpanel 共享主机上托管 expressjs 应用程序?
- c# - 如何解决获取实际应用路径base .net Staandard libaray 2.0的发布
- python - 如何将一个 numpy 数组拆分为两个不同大小的新 numpy 数组?
- json - Python - 提取嵌套的json不起作用
- ios - 在 Xcode 11.5 中,我正在尝试下载所需的配置文件。帐户屏幕上的代理和用户有什么区别?
- bluetooth-lowenergy - 网络蓝牙的长特性
- jquery - Angular Datatables - fnInfoCallback 等价物
- android-studio - 模拟器显示错误“无法找到 adb”