小编Dav*_*idH的帖子

在PHP中,我无法从一个进程管道到另一个进程

在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 );
Run Code Online (Sandbox Code Playgroud)

在child.php我有这个:

$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]); …
Run Code Online (Sandbox Code Playgroud)

php pipe timer

6
推荐指数
1
解决办法
74
查看次数

标签 统计

php ×1

pipe ×1

timer ×1