我向模板传递了一个字符串数组,我想将其转换为 jaavascript 数组:
控制器文件(php):
$myVar = array('a','b','c');
所需的html:
var myVar = ["a","b","c"];
我尝试以下代码(树枝):
var myVar = ["{{ myVar | join('","') }}"];
但是树枝生成器将引号转换为 html 实体,结果如下:
var myVar = ["a","b","c"];
有什么想法?