1
我想让我的php文件在后台运行。 当我GOOGLE时,我发现exec()
用于在后台运行。我正在使用CentOS服务器。 因此,为了使用exec
,我应该安装哪些基本的东西? 我甚至不知道如何在终端中运行。 我应该遵循什么步骤来使用exec()
在后台运行php脚本?在后台运行php脚本centos server
我在Google上找到了这个例子,但我不知道在$cmd
中使用什么。
function execInBackground($cmd) {
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec($cmd . " > /dev/null &");
}
}