【发布时间】:2018-12-28 09:44:53
【问题描述】:
我有一个聪明的项目。在 php 文件中,我将动态分配变量 bar。
在php文件对应的模板中:
{if $bar}{$bar}{/if}
但我会得到以下错误:
Notice: Undefined index: bar in /Users/sof/Desktop/TestIOS/smarty-test02/templates_c/6f98597c1882f0124e0891c8343f1404eff83e24_0.file.test.tpl.cache.php on line 63
Notice: Trying to get property of non-object in /Users/sof/Desktop/TestIOS/smarty-test02/templates_c/6f98597c1882f0124e0891c8343f1404eff83e24_0.file.test.tpl.cache.php on line 63
如何判断一个变量是否赋值?
【问题讨论】: