<?php

if (! function_exists('pcntl_fork')) die('PCNTL functions not available on this PHP installation');
$pid = pcntl_fork();
var_dump("aaaaaaa");
if ($pid == -1) {
die('could not fork');
} else if($pid) {
var_dump("bbbbbbbbbbbbbb");
pcntl_wait($status);
} else {
var_dump("cccccccccccccc");
}

结果输出

string(7) "aaaaaaa"
string(14) "bbbbbbbbbbbbbb"
string(7) "aaaaaaa"
string(14) "cccccccccccccc"

posted on 2012-08-28 15:04  Rik~  阅读(190)  评论(0编辑  收藏  举报