我用 PHP 完成了一些工作,现在我需要验证(仅语法验证)用户是否在我的表单字段之一中编写了有效的 JS。除了 JSLint 之外,我还有哪些选择?
最佳答案
要检查语法,您可以使用 javascript 解析器,例如Esprima 解析器 ( http://esprima.org/demo/validate.html ) 或 Acorn.js ( https://github.com/marijnh/acorn )。还有纯 php 实现 - jParser - http://apps.timwhitlock.info/jparser/index.html
关于javascript - 验证 JS 代码的 API/库/工具?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26219516/