為什么在模板上傳遞的參數(shù)不能打包成數(shù)組?
在控制器的代碼
function?test($params){ print_r($params); exit(); $p1=$params[p1]; $p2=$params[p2]; return?'傳入的第一個參數(shù)是'.$p1.'傳入的第二個參數(shù)是'.$p2; } $smarty->registerPlugin('function','f_test','test'); $smarty->display('test.tpl');
在模板上的代碼
{f_test?p1='abcd'?p2='efgh'}
在網(wǎng)頁上看不到任何數(shù)據(jù)
2016-12-27
你的php沒有進行報錯或警告嗎?
里面出現(xiàn)了這種代碼:
使用數(shù)組元素的時候要給元素名加上引號呀
2016-06-21