[英]Php exec - not work with parameters
I need to use exec()
function, but it doesn't work with params. 我需要使用exec()
函数,但不适用于params。
It works: 有用:
exec('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe');
It doesn't: 它没有:
exec('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe --headless --disable-gpu --screenshot=D:\\file211.png --window-size=1920,1200 http://google.com')
What to do to set params in exec? 如何在exec中设置参数?
http://php.net/manual/en/function.exec.php : http://php.net/manual/zh/function.exec.php :
Note: On Windows exec() will first start cmd.exe to launch the command. 注意:在Windows上,exec()将首先启动cmd.exe以启动命令。 If you want to start an external program without starting cmd.exe use proc_open() with the bypass_shell option set. 如果要在不启动cmd.exe的情况下启动外部程序,请使用proc_open(),并将其设置为bypass_shell选项。
You can also use popen() instead of proc_open(): 您也可以使用popen()代替proc_open():
$handle = popen('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe --headless --disable-gpu --screenshot=D:\\file211.png --window-size=1920,1200 http://google.com', 'r');
... ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.