2014-09-04 88 views

回答

0

在這種情況下,您需要使用類似於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}),因爲它可能會在鍵中查找空格。即使添加引號也無濟於事。

+0

不,它不起作用({$ customPre ['請指定哪個基金']})。仍然給我空白的值 – user3259992 2014-09-04 09:58:39

+0

@ user3259992因此,您應該展示如何以及從PHP分配給Smarty – 2014-09-04 22:03:52