还不快抢沙发

添加新评论

Swoole process manager can be used to replace PHP pcntl extension. Compare with PHP pcntl, Swoole process manager provides more features: - Interprocess communication based on unixsock, with read/write or push/pop API. - Redirect standard input and output - The child process can use swoole_event callbacks. - Exec API enable the child process execute Linux applications and communicate with parent process ### __construct public Swoole\Process::__construct ( callable $callback [, boolean $redirect_stdin_and_stdout = false [, integer $pipe_type = 2 ]] ) 参数说明 - $callback,子进程被创建以后执行的函数,底层会自动将函数保存到对象的callback属性上。如果希望更改执行的函数,可赋值新的函数到对象的callback属性 - $redirect_stdin_and_stdout,重定向子进程的标准输入和输出。启用此选项后,在子进程内输出内容将不是打印屏幕,而是写入到主进程管道。读取键盘输入将变为从管道中读取数据。默认为阻塞读取。 - $pipe_type,是否创建管道。0不创建管道,1创建SOCK_STREAM管道(基于TCP),2创建SOCK_DGRAM管道(基于UDP)。如果$redirect_stdin_and_stdout为true,该参数被设置为1。 ```