php 后台json 转 js数组
1.字符串
$this->assign('id',$id);
var health_id = '<?php echo $id;?>';
2-1数组
$this->assign('cycle', ArchivesUtil::CYCLE);
var cycle = eval("(" + '<?php echo json_encode($cycle);?>' + ")");
或
var mobile = "<?php echo $cycle['mobile']; ?>";
2-2
$this->assign('arr', json_encode($arr));
Var arr = {$arr};
例子:json转js数组、遍历key值
----------------------------------------------------------------------------------------------------------------------
tp5
var info = {$info|raw};