在PHP I';我无法从一个进程到另一个进程
在timer.php中,我有以下内容:在PHP I';我无法从一个进程到另一个进程,php,timer,pipe,Php,Timer,Pipe,在timer.php中,我有以下内容: $handle = fopen( 'php://stdout', 'wa' ) ; $unusedEvTimerObject = new EvTimer(0, 1, function ($watchercallback) use ($handle) { //create & call timer echo "=>".(Ev::iteration() % 60)."<="; fwrite( $handle,
$handle = fopen( 'php://stdout', 'wa' ) ;
$unusedEvTimerObject = new EvTimer(0, 1, function ($watchercallback) use ($handle) { //create & call timer
echo "=>".(Ev::iteration() % 60)."<=";
fwrite( $handle, "Hello World! \n");
} );
Ev::run();
fclose( $handle );
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "/tmp/error-output.txt", "a")
);
$process = proc_open('php ', $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], "<? include('app/timer.php'); ?>");
fclose($pipes[0]);
$output = "";
while (!feof($pipes[1])) {
$output .= fgets($pipes[1]);
};
fclose($pipes[1]);
$return_value = proc_close($process);
echo "command returned $return_value\n";
}
$handle=fopen('php://stdout","wa",;
$unusedEvTimerObject=新的EvTimer(0,1,函数($watchercallback)使用($handle){//创建和调用计时器
echo“=>”(Ev::iteration()%60)。“示例代码中未打印$output
while (!feof($pipes[1])) {
echo fgets($pipes[1]);
};
调用$>php child.php然后打印计时器输出您可以尝试捕获子文件中缓冲区中的所有输出,然后在最后输出它