swoole_process::__construct

�����ӽ���

int swoole_process::__construct(mixed $function, $redirect_stdin_stdout = false, $create_pipe = true);
  • $process����������ʱ���Զ��رչܵ����ӽ�������������˹ܵ����յ�CLOSE�¼�
  • 1.7.22����߰汾�������ùܵ������ͣ�Ĭ��ΪSOCK_STREAM��ʽ
  • ����$create_pipeΪ2ʱ���ܵ����ͽ�����ΪSOCK_DGRAM

���ӽ����д���swoole_server

������swoole_process�������ӽ�����swoole_server���������򣬵�Ϊ�˰�ȫ������$process->start�������̺󣬵���$worker->execִ��server�Ĵ��롣

<?php
$process = new swoole_process('callback_function', true);
$pid = $process->start();

function callback_function(swoole_process $worker)
{
    $worker->exec('/usr/local/bin/php', array(__DIR__.'/swoole_server.php'));
}

swoole_process::wait();