我有一个 casperJS 脚本,通过命令行运行时会返回 JSON。我想最好在 PHP 中创建一个 API,它在命令行(casperJS Sample.js)中运行脚本并返回 JSON 作为结果。
您可以使用php-casperjs库是一个简单的包装器casperjs.
casperjs