核心:进程管理 - lizhibin205/php_crond GitHub Wiki
进程管理
使用symfony/process包进行进程管理,任务执行时,启用一个子进程执行。
$process = new Process($processCommand);
$process->start(function ($type, $buffer) use($task) {
if ($type === Process::ERR) {
$filename = $task->getStderr();
} else {
$filename = $task->getStdout();
}
\file_put_contents($filename, $buffer, FILE_APPEND);
});
这样会使用proc_open来启动一个子进程,对于该系列函数,可以参考: