swoole_process::__construct
�����ӽ���
int swoole_process::__construct(mixed $function, $redirect_stdin_stdout = false, $create_pipe = true);
- $function���ӽ��̴����ɹ���Ҫִ�еĺ���
- $redirect_stdin_stdout���ض����ӽ��̵ı����������� ���ô�ѡ����ڽ�����echo�����Ǵ�ӡ��Ļ������д�뵽�ܵ�����ȡ�������뽫��Ϊ�ӹܵ��ж�ȡ���ݡ� Ĭ��Ϊ������ȡ��
- $create_pipe���Ƿ��ܵ�������$redirect_stdin_stdout��ѡ������û�������ǿ��Ϊtrue ����ӽ�����û�н��̼�ͨ�ţ���������Ϊfalse
- $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();