如何通过浏览器执行phantomjs php?

时间:2017-02-02 21:35:37

标签: php phantomjs

我在shell上执行此操作并获得结果

[root @ s1~]#phantomjs /opt/phantomjs/examples/hello.js 你好,世界!

但如何通过浏览器在php上执行此操作?

1 个答案:

答案 0 :(得分:0)

在php中使用exec函数发出与shell相同的调用。

exec("/opt/phantomjs/bin/phantomjs /opt/phantomjs/examples/hello.js", $output);
echo $output;

最好使用二进制和脚本的完整路径来避免查找fikes的问题,因为你的php脚本可能位于完全不同的位置。

相关问题