PHP多线程类--疯子哥德
    哥德疯了
   用户中心 您的位置:笔架山信息平台>> 笔客秀>> 疯子哥德>> PHP多线程类--疯子哥德
日历
<< << 2008 十一月 >> >>
1
2345678
9101112131415
16171819202122
23242526272829
30
个人资料
游客已登陆 (0)未知
笔行证 888888
昵称 hacder 
笔贝 Score1
加为好友 发送短信
栏目分类
最新日志
最新评论
统计信息
  • 访问计数:1584659
    本文:370 今天:1 本月 370
  • 加为好友 发送短信

  PHP多线程类
2007-05-16 晴


刚刚看到的,随手保存下来了,主要是思路不错

PHP代码:


<?php



$th
=new thread(10);//10个线程

$th->exec('demo');//执行自定义的函数



function demo() {

        
fopen('data/'.microtime(),'w');

}



class 
thread {

        var 
$count;

        function 
thread($count=1) {



                
$this->count=$count;

        }

   

           function 
_submit() {

                for(
$i=1;$i<=$this->count;$i++) $this->_thread(); 

                return 
true;

        }



        function 
_thread() {

                
$fp=fsockopen($_SERVER['HTTP_HOST'],80); 

                
fputs($fp,"GET \$_SERVER[PHP_SELF]?flag=1\r\n"); 

                
fclose($fp); 

        }

        

        function 
exec($func) {

                isset(
$_GET['flag'])?call_user_func($func):$this->_submit(); 

        }





}



?> 

.
# posted by hacder @ 2007-05-16 01:22:31 评论(0)




地址:




 
笔 名:
*
评 论:
最多1000字。当前字数:0
*
联系方式:

             

 
copyriht© beaplat.com All Rights Reserved 笔架山信息平台
Powered by 笔架山信息平台技术研发小组 henry
本站版权归笔架山信息平台所有,未经书面授权禁止使用