0
我有一個數組$ customPre。我想打印數組的元素「請指定哪個基金」。我這樣做:在smarty中打印這個變量
{$customPre.Please specify which fund}
但它不工作。
我有一個數組$ customPre。我想打印數組的元素「請指定哪個基金」。我這樣做:在smarty中打印這個變量
{$customPre.Please specify which fund}
但它不工作。
在這種情況下,您需要使用類似於PHP的類似PHP的語法:{$variable['key']}
。
如果在PHP中你有:
$smarty->assign('customPre', array ('Please specify which fund' => 'This is value'));
在Smarty的你需要使用:
{$customPre['Please specify which fund']}
和輸出的,這將是:
這是價值
我相信你不能在這種情況下使用點語法({$customPre.Please specify which fund}
),因爲它可能會在鍵中查找空格。即使添加引號也無濟於事。
不,它不起作用({$ customPre ['請指定哪個基金']})。仍然給我空白的值 – user3259992 2014-09-04 09:58:39
@ user3259992因此,您應該展示如何以及從PHP分配給Smarty – 2014-09-04 22:03:52