Smarty如何将数组变量赋值给js
程序员文章站
2024-02-06 21:50:10
...
PHP文件中有类似代码:
$arr = array('A','B','C');
$smarty = new Smarty();
$smarty->assign('arr',$arr);
$smarty->display('test.html');
test.html大概是这样的
===========================================================
怎么做比较简单,求解!
$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));
谢了 非常好!
非常有用,谢谢!
上一篇: 根据某一键名对键值相同的分类