php值赋值给js

180it 2020-05-22 PM 1685℃ 0条

php值赋值给js

怕是不尽芳华 2018-12-04 11:19:50 314 收藏

网上都是这样的:var arr="<?php echo $menus;?>";
但我用了之后一直报错:Uncaught SyntaxError: Unexpected identifier

最终这样可以
let menuList = <?php echo $menus; ?>;
console.log(menuList);
————————————————

原文链接:https://blog.csdn.net/qq_41066340/article/details/84785456

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

php值赋值给js