Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
而monitor赢了';t停止运行(php)_Php_While Loop - Fatal编程技术网

而monitor赢了';t停止运行(php)

而monitor赢了';t停止运行(php),php,while-loop,Php,While Loop,我正在使用while循环输出“.”,而服务器端脚本正在使用exec运行。这一点非常有效,因为它从未停止运行,也就是说,“……将继续建设到无限远 是否有人知道在客户端完成运行后进行更新的方法: $dbupdate = ($siteurl."/data_update.php"); $runupdate = exec("nohup curl ".$dbupdate." > /dev/null 2>&1 & echo $!"); while(exec("ps $runup

我正在使用while循环输出“.”,而服务器端脚本正在使用exec运行。这一点非常有效,因为它从未停止运行,也就是说,“……将继续建设到无限远

是否有人知道在客户端完成运行后进行更新的方法:

$dbupdate = ($siteurl."/data_update.php");

$runupdate = exec("nohup curl ".$dbupdate." > /dev/null 2>&1 & echo $!");

while(exec("ps $runupdate"))
{ 
     echo(" . ");
       ob_flush(); flush();
}

这是因为
while()
将继续执行,直到条件为
false/null/0
,并且
exec()
返回void。 文件:

像这样的东西可能有用吗

$runupdate = exec("nohup curl ".$dbupdate." > /dev/null 2>&1 & echo $!");
// Spitballing here...
$pid = true;
// Execute only while $op is strictly true, and not the PID that `echo $!` returns
while( $pid === true )
{ 
     exec("ps $runupdate", $pid);
     echo(" . ");
     ob_flush(); flush();
}

查看此处的文档:

如何将
$pid
更改为与
true
不同的值?