1<?php 2$process = new swoole_process(function (swoole_process $worker) 3{ 4 echo "Worker: start. PID=" . $worker->pid . "\n"; 5 sleep(2); 6 $worker->close(swoole_process::PIPE_READ); 7 $worker->write("hello master\n"); 8 $worker->exit(0); 9}, false); 10 11$pid = $process->start(); 12$r = array($process); 13$w = array(); 14$e = array(); 15$ret = swoole_select($r, $w, $e, 1.0); 16var_dump($ret); 17var_dump($process->read()); 18