我重写Mark's answer用于Windows和到目前为止,我想出了这一点:执行在PHP后台进程在Windows
// Escape character for Windows is:^
$shellCmd = 'start /B cmd /c ' . escapeshellcmd($cmd) . ' ^>"'.$outputfile. '"';
// note that exec was like 40 times slower than popen & pclose
pclose(popen($shellCmd, "r"));
有在Windows tasklist
命令,但我不知道怎么找取出我的流程的PID。为了准时,我正在寻找通过popen打开的进程的PID。
你能帮我吗? 谢谢!
注意:我不确定这段代码如何处理错误输出,但在我的情况下并不重要。在这些功能
我寻找通过popen打开的进程的PID。 –
你应该添加,作为你的问题的第一句:) – hakre