Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHPÖÐʵÏÖ·Ç×èÈûģʽ

³ÌÐò·Ç×èÈûģʽ£¬ÕâÀïÒ²¿ÉÒÔÀí½â³É²¢·¢¡£¶ø²¢·¢ÓÖÔÝÇÒ¿ÉÒÔ·ÖÎªÍøÂçÇëÇó²¢·¢
ºÍ±¾µØ²¢·¢
¡£
ÏÈ˵һÏÂÍøÂçÇëÇó²¢·¢
ÀíÂÛÃèÊö
¼ÙÉèÓÐÒ»¸öclient£¬³ÌÐòÂß¼­ÊÇÒªÇëÇóÈý¸ö²»Í¬µÄserver£¬´¦Àí¸÷×ÔµÄÏìÓ¦¡£´«Í³Ä£Ð͵±È»ÊÇ˳ÐòÖ´ÐУ¬ÏÈ·¢Ë͵ÚÒ»¸öÇëÇ󣬵ȴýÊÕµ½ÏìÓ¦Êý¾ÝºóÔÙ·¢Ë͵ڶþ¸öÇëÇó£¬ÒÔ´ËÀàÍÆ¡£¾ÍÏñÊǵ¥ºËCPU£¬Ò»´ÎÖ»ÄÜ´¦ÀíÒ»¼þÊ£¬ÆäËûÊÂÇé±»ÔÝʱ×èÈû¡£¶ø²¢·¢Ä£Ê½¿ÉÒÔÈÃÈý¸öserverͬʱ´¦Àí¸÷×ÔÇëÇó£¬Õâ¾Í¿ÉÒÔʹ´óÁ¿Ê±¼ä¸´Óá£
»­¸öͼ¸üºÃ˵Ã÷ÎÊÌ⣺
ǰÕßΪ×èÈûģʽ£¬ºöÂÔÇëÇóÏìÓ¦µÈʱ¼ä£¬×ܺÄʱΪ700ms£»¶øºóÕß·Ç×èÈûģʽ£¬ÓÉÓÚÈý¸öÇëÇó¿ÉÒÔͬʱµÃµ½´¦Àí£¬×ܺÄʱֻÓÐ300ms¡£
´úÂëʵÏÖ
<?php
echo "Program starts at ". date('h:i:s') . ".\n";
$timeout = 3;
$sockets = array(); //socket¾ä±úÊý×é
//Ò»´Î·¢Æð¶à¸öÇëÇó
$delay = 0;
while ($delay++ < 3)
{
$sh = stream_socket_client("localhost:80", $errno, $errstr, $timeout,
STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT);
/* ÕâÀïÐèÒªÉÔ΢ÑÓ³Ùһϣ¬·ñÔòÏÂÃæfwriteÖеÄsocket¾ä±ú²»Ò»¶¨ÄÜÕæÕýʹÓÃ
ÕâÀïÓ¦¸ÃÊÇPHPµÄÒ»´¦bug£¬²éÁËһϣ¬¹Ù·½bugÔçÔÚ08Äê¾ÍÓÐÈËÌá½»ÁË
ÎÒµÄ5.2.8ÖÐÉÐδ½â¾ö£¬²»Öª×îеÄ5.3ÖÐÊÇ·ñÐÞÕý
*/
usleep(10);
if ($sh) {
$sockets[] = $sh;
$http_header = "GET /test.php?n={$delay} HTTP/1.0\r\n";
$http_header .= "Host: localhost\r\n";
$http_header .= "Accept: */*\r\n";
$http_header .= "Accept-Charset: *\r\n";
$http_header .= "\r\n";
fwrite($sh, $http_header);
} else {
echo "Stream failed to open correctly.\n";
}
}
//·Ç×èÈûģʽÀ´½ÓÊÕÏìÓ¦
$result = array();
$read_block_size = 8192;
while (count($sockets))
{
$read = $sockets;
$n = stream_select($read, $w=null, $e=null, $timeout);
//if ($n > 0) //¾Ý˵stream_select·µ»ØÖµ²»×ÜÊÇ¿ÉÐÅÈεÄ
if (count($read))
{
/* stream_select generally shuffles $read, so we need to
compute from which socket(s) we're reading. */
fo


Ïà¹ØÎĵµ£º

ÔÚPHPÖбéÀúÊý×éÔªËØ

Ô­ÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/20100411/56.html
ÔÚPHPÖÐʹÓÃforeachº¯Êý¿ÉÒÔ±éÀúÊý×é¡£Foreach½öÄÜÓÃÓÚÊý×飬Óï·¨ÈçÏ£º
 Foreach(array as $value) statements
 Foreach(array as $key=>$value) statement
µÚÒ»ÖÖÓï·¨±éÀúÊý×éʱ£¬Ã¿´ÎÑ­»·Ê±£¬µ±Ç°µ¥ÔªµÄÖµ±»¸³¸ø$value£¬Êý×éÄÚ²¿µÄÖ¸ÕëÏòǰ ......

½¼ÌÕûÀí×Ô¼º²ÎÓëµÄphp°æÕýÔòÌù×Ó


´ÓHTMLÎļþÖжÁȡָ¶¨×Ö·û´®
          Ô­ÌùµØÖ·£ºhttp://topic.csdn.net/u/20100322/10/d7401c38-10b7-4231-a323-454caf946fa6.html
    2.   
          <a title="1" href="sdfds" m ......

PHPÖÐforeach±éÀúÊý×é(2)

<?php
  //ÉùÃ÷Êý×é±äÁ¿
  $arr = array('ÕÅÈý','ÀîËÄ','ÍõÎå','ÀîÃ÷');
 
  //foreachÑ­»·±éÀúÊý×é
  foreach($arr as $value){
   //×¢Òâ“$value”ºó±ØÐëÒªÒ»¸ö¿Õ¸ñ£¬·ñÔòÊä³öµÄ½á¹û²»ÕýÈ·
   echo "$value<br/>";
  }
?> ......

PHPʵÏÖÊ×Ò³×Ô¶¯Ñ¡ÔñÓïÑÔ×ªÌø

http://www.111cn.net/phper/19/dd73e6624c92e49e7755d3b43719677d.htm
ºÜ¶àÍøÕ¾ÔÚÊ×Ò³ÉÏ×öһЩÁ´½Ó£¬ÈÃÓû§À´Ñ¡Ôñ½«Òª·ÃÎʵĸ÷×ÔµÄÓïÑÔÒ³Ãæ£¬ÈÃÖйúÈËÑ¡Ôñ“ÖÐÎÄ”£¬º«¹úÈËÑ¡Ôñ“³¯ÏÊÓ¬µÈµÈ¡£ÄÇôÄܲ»ÄÜ×ö³ÌÐòÀ´×Ô¶¯°ïÖúÑ¡ÔñÄØ£¿
´ð°¸Êǿ϶¨µÄ£¬´ó¼Ò¶¼ÔÚÓÃgoogle£¬ÄãÓÃÖÐÎÄϵͳ´ò¿ªgoogleµÄÊ×Ò³ ......

phpÔÚ2003SERVERϵÄÅäÖÃ

Ò»¡¢ÏµÍ³»·¾³¼°³ÌÐò˵Ã÷
1¡¢²Ù×÷ϵͳΪwindows server 2003
2 ¡¢iis°æ±¾Îª6.0
3¡¢php°æ±¾Îª5.2.9,¹Ù·½ÏÂÔØµØÖ·: http://www.php.net/downloads.php
4¡¢mysql°æ±¾Îª5.1.34,¹Ù·½ÏÂÔØµØÖ·:http://dev.mysql.com/downloads/mysql
¶þ¡¢°²×°iis
1¡¢²åÈëwindows server 2003ϵͳ°²×°¹âÅÌ
2¡¢¿ªÊ¼-¿ØÖÆÃæ°å-Ìí¼Óɾ³ý³ÌÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ