Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.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
在PHP I';我无法从一个进程到另一个进程_Php_Timer_Pipe - Fatal编程技术网

在PHP I';我无法从一个进程到另一个进程

在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,

在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, "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然后打印计时器输出

您可以尝试捕获子文件中缓冲区中的所有输出,然后在最后输出它