php system exexc 立即返回

有时候会用到php调用服务器端的其它可执行文件,system和exec函数都是阻塞执行的,执行完第三方程序再返回。

如果我们需要立即返回,让第三方程序在后台继续执行,调用方式如下:

linux,nohup

1、 system(“nohup ./test.py $s >>/tmp/output.txt &”);

2、 system(“nohup ./test.py $s > /dev/null 2>&1 &”); 

 window,将你的程序再用bat调用一下,

bat文件中就一句话:

start 123.exe

有更好的方法请留言。

原文地址:https://www.cnblogs.com/dwj192/p/9711535.html