我正在尝试使用以下命令在后台处理文件,但它什么都不做.
exec("php csv.php $file $user > /dev/null &", $output);
Run Code Online (Sandbox Code Playgroud)
如果我删除> /dev/null &然后文件进程,但不在后台.
exec("php csv.php $file $user", $output);
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
Eme*_*ing 30
注意:
如果使用此函数启动程序,为了使其在后台继续运行,必须将程序的输出重定向到文件或其他输出流.如果不这样做将导致PHP挂起,直到程序执行结束.
http://php.net/manual/en/function.exec.php
所以:
exec("php csv.php $file $user > /dev/null &"); // no $output
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20150 次 |
| 最近记录: |