Smarty怎么将数组变量赋值给js
时间:2021-07-01 10:21:17
帮助过:7人阅读
Smarty如何将数组变量赋值给js
PHP文件中有类似代码:
$arr = array('A','B','C');
$smarty = new Smarty();
$smarty->assign('arr',$arr);
$smarty->display('test.html');
test.html大概是这样的
===========================================================
怎么做比较简单,求解!
分享到:
------解决方案--------------------
$smarty->assign('js_arr',json_encode($arr));