问题描述
比方说,我在PHP中有这段代码可以调用Phantomjs
Let's say I have this code in PHP to call Phantomjs
shell_exec("phantomjs a-phantomjs-file.js");
是否可以将数据从PHP传递到phantomjs文件?也许有一些命令行参数?
Is there way to pass data from PHP to the phantomjs file? Some sort of commandline arguments perhaps?
推荐答案
此处提供了适用于phantomjs的命令行参数列表: https://github.com/ariya/phantomjs/wiki/API-Reference
There is a list of command line arguments for phantomjs here: https://github.com/ariya/phantomjs/wiki/API-Reference
您可以使用字符串连接或内插法从PHP传递它们,只是要注意并小心以防自变量可能来自用户输入而遭受注入攻击.
You can use string concatenation or interpolation to pass them from PHP, just be aware of and careful to protect against injection attacks if the arguments could ever be coming from user input.
这篇关于Phantomjs-有没有办法将参数传递给的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!