<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="详解PHP中多进程编程的相关函数的使用（附实例）" id="card1">
<p> 游客</p><p>
标题:详解PHP中多进程编程的相关函数的使用（附实例）<br/>
正文:<br/>
    PHP有一组进程控制函数(编译时需要&amp;ndash;enable-pcntl与posix扩展)，使得php能实现跟c一样的创建子进程、使用exec函数执行程序、处理信号等功能。   &amp;lt;?php   header('content-type:text/html;charset=utf-8' );      // 必须加载扩展   if (!function_exists(&amp;quot;pcntl_fork&amp;quot;)) {     die(&amp;quot;pcntl extention is must !&amp;quot;);   }   //总进程的数量   $totals = 3;   // 执行的脚本数量   $cmdArr = array();   // 执行的脚本数量的数组   for ($i = 0; $i &amp;lt; $totals; $i++) {     $cmdArr[] = array(&amp;quot;path&amp;quot; =&amp;gt; __DIR__ . &amp;quot;/run.php&amp;quot;, 'pid' =&amp;gt;$i ,'total' =&amp;gt;$totals);   }      /*   展开：$cmdArr   Array   (     [0] =&amp;gt; Array       (         [path] =&amp;gt; /var/www/html/company/pcntl/run.php         [pid] =&amp;gt; 0         [total] =&amp;gt; 3       )        [1] =&amp;gt; Array       (         [path] =&amp;gt; /var/www/html/company/pcntl/run.php         [pid] =&amp;gt; 1         [total] =&amp;gt; 3       )        [2] =&amp;gt; Array       (         [path] =&amp;gt; /var/www/html/company/pcntl/run.php         [pid] =&amp;gt; 2         [total] =&amp;gt; 3       )      )  <br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2144&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2144&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2144&amp;Page=2">[2]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2144&amp;Page=3">[3]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2144&amp;Page=12">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=2144">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=2144">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>