Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在win XP上运行PHP,我exec()在我的程序中使用了一些东西,但每次exec()运行cmd.exe时,服务器上都会打开一个窗口几秒钟。我怎样才能让它在后台运行?
exec()
cmd.exe
在命令前加上start /B.
start /B
$process = popen("start /B ". $cmd, "r");
https://www.php.net/manual/function.exec.php#86329
$WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run('yourprogpath', 0, false);
仅限窗户。
编辑 - 我认为 Fraxtil 的答案可能会更好,如果它适用于 Windows 和 unix。