2014-03-31 146 views
1

如何在後臺使用&執行shell命令?我已經嘗試:如何在後臺執行shell命令

php -r "shell_exec('sleep 10 &');" 

php -r "shell_exec('/bin/bash -c \"sleep 10 &\"');" 

在這兩種情況下,暫停10秒,而不是隻給背殼並在後臺運行的睡眠。

回答

3

您必須在某處重新路由輸出。試試這樣的:

php -r "shell_exec('sleep 10 > /dev/null &');"