phpʵÏÖ¶àÏß³Ì
ת£ºhttp://blog.iyi.cn/start/
ÎÊÌ⣺
ÓÐûÓа취ÔÚphpÖÐʵÏÖ¶àÏß³ÌÄØ£¿
¼ÙÉèÄãÕýÔÚдһ¸ö»ùÓÚ¶ą̀·þÎñÆ÷µÄphpÓ¦Óã¬ÀíÏëµÄÇé¿öʱͬʱÏò¶ą̀·þÎñÆ÷·¢ËÍÇëÇ󣬶ø²»ÊÇһ̨½Óһ̨¡£
¿ÉÒÔʵÏÖÂð£¿
»Ø´ð£º
µ±ÓÐÈËÏëҪʵÏÖ²¢·¢¹¦ÄÜʱ£¬ËûÃÇͨ³£»áÏëµ½ÓÃfork»òÕßspawn threads£¬µ«Êǵ±ËûÃÇ·¢ÏÖphp²»Ö§³Ö¶àÏ̵߳Äʱºò£¬´ó¸Å»áת»»Ë¼Â·È¥ÓÃһЩ²»¹»ºÃµÄÓïÑÔ£¬±ÈÈçperl¡£
ÆäʵµÄÊÇ´ó¶àÊýÇé¿öÏ£¬Äã´ó¿É²»±ØʹÓÃfork»òÕßỊ̈߳¬²¢ÇÒÄã»áµÃµ½±ÈÓÃfork»òthread¸üºÃµÄÐÔÄÜ¡£
¼ÙÉèÄãÒª½¨Á¢Ò»¸ö·þÎñÀ´¼ì²éÕýÔÚÔËÐеÄn̨·þÎñÆ÷£¬ÒÔÈ·¶¨ËûÃÇ»¹ÔÚÕý³£ÔËת¡£Äã¿ÉÄÜ»áдÏÂÃæÕâÑùµÄ´úÂ룺
<?php
$hosts = array("host1.sample.com", "host2.sample.com", "host3.sample.com");
$timeout = 15;
$status = array();
foreach ($hosts as $host) {
$errno = 0;
$errstr = "";
$s = fsockopen($host, 80, $errno, $errstr, $timeout);
if ($s) {
$status[$host] = "Connectedn";
fwrite($s, "HEAD / HTTP/1.0rnHost: $hostrnrn");
do {
$data = fread($s, 8192);
if (strlen($data) == 0) {
break;
}
$status[$host] .= $data;
} while (true);
fclose($s);
} else {
$status[$host] = "Connection failed: $errno $errstrn";
}
}
print_r($status);
?>
ËüÔËÐеĺܺ㬵«ÊÇÔÚfsockopen()·ÖÎöÍêhostname²¢ÇÒ½¨Á¢Ò»¸ö³É¹¦µÄÁ¬½Ó£¨»òÕßÑÓʱ$timeoutÃ룩֮ǰ£¬À©³äÕâ¶Î´úÂëÀ´¹Ü Àí´óÁ¿·þÎñÆ÷½«ºÄ·ÑºÜ³¤Ê±¼ä¡£
Òò´ËÎÒÃDZØÐë·ÅÆúÕâ¶Î´úÂ룻ÎÒÃÇ¿ÉÒÔ½¨Á¢Òì²½Á¬½Ó-²»ÐèÒªµÈ´ýfsockopen·µ»ØÁ¬½Ó״̬¡£PHPÈÔÈ»ÐèÒª½âÎöhostname£¨ËùÒÔÖ±½ÓʹÓÃip¸ü ¼ÓÃ÷ÖÇ£©£¬²»¹ý½«ÔÚ´ò¿ªÒ»¸öÁ¬½ÓÖ®ºóÁ¢¿Ì·µ»Ø£¬¼Ì¶øÎÒÃǾͿÉÒÔÁ¬½ÓÏÂһ̨·þÎñÆ÷¡£
ÓÐÁ½ÖÖ·½·¨¿ÉÒÔʵÏÖ£»PHP5ÖпÉÒÔʹÓÃÐÂÔöµÄstream_socket_client()º¯ÊýÖ±½ÓÌæ»»µôfsocketopen()¡£PHP5֮ǰµÄ °æ±¾£¬ÄãÐèÒª×Ô¼º¶¯ÊÖ£¬ÓÃsocketsÀ©Õ¹½â¾öÎÊÌâ¡£
ÏÂÃæÊÇPHP5ÖеĽâ¾ö·½·¨£º
<?php
$hosts = array("host1.sample.com", "host2.sample.com", "host3.sample.com");
$timeout = 15;
$status = array();
$sockets = array();
/* Initiate connections to all the hosts simultaneously */
foreach ($hosts as $id => $host) {
$s = stream_socket_client("$host:80", $e
Ïà¹ØÎĵµ£º
PHP XML²Ù×÷ÀàDOMDocumentÊôÐÔ¼°·½·¨
×¢Òâ´óСдһ¶¨²»ÄÜŪ´í.
ÊôÐÔ:
Attributes ´æ´¢½ÚµãµÄÊôÐÔÁбí(Ö»¶Á)
childNodes ´æ´¢½ÚµãµÄ×Ó½ÚµãÁбí(Ö»¶Á)
dataType ·µ»Ø´Ë½ÚµãµÄÊý¾ÝÀàÐÍ
Definition ÒÔDTD»òXMLģʽ¸ø³öµÄ½ÚµãµÄ¶¨Òå(Ö»¶Á)
Doctype Ö¸¶¨ÎĵµÀàÐͽڵã(Ö»¶Á)
documentElement ·µ»ØÎĵµµÄ¸ùÔªËØ(¿É¶Áд)
fi ......
PDOΪºÎÎï
POD£¨PHP Data Object£©À©Õ¹ÔÚPHP5ÖмÓÈ룬PHP6Öн«Ä¬ÈÏʶÓÃPDOÁ¬½ÓÊý¾Ý¿â£¬ËùÓзÇPDOÀ©Õ¹½«»áÔÚPHP6±»´ÓÀ©Õ¹ÖÐÒƳý¡£¸ÃÀ©Õ¹ÌṩPHPÄÚÖÃÀà PDOÀ´¶ÔÊý¾Ý¿â½øÐзÃÎÊ£¬²»Í¬Êý¾Ý¿âʹÓÃÏàͬµÄ·½·¨Ãû£¬½â¾öÊý¾Ý¿âÁ¬½Ó²»Í³Ò»µÄÎÊÌâ¡£
ÎÒÊÇÅäÖÃÔÚwindowsÏÂ×ö¿ª·¢Óõġ£
PDOµÄÄ¿±ê
ÌṩһÖÖÇáÐÍ¡¢ÇåÎú¡¢·½±ãµÄ API
ͳ ......
×î½üŪPHPÓʼþ·¢ËÍʱ£¬´ÓÍøÉÏÔØÁ˶δúÂ룬×ÜÊÇÓÐЩÎÊÌ⣬ËùÒÔ¶ÔÕâЩÎÊÌâµÄ½â¾ö×÷Ò»¸ö¼Ç¼£¬·½±ãÒÔºó²éÔÄ¡£
PHP·¢ËÍÓʼþ£º
1¡¢class.phpmailer.php Àà°üµÄ¹ÙÍøÏÂÔØ×îаæµÄphpmailerÀ࣬Ҫע²áµÄŶ¡£
2¡¢×¢Òâ¿´ÄãµÄ·¢ËÍÓÊÏäÊDz»ÊÇ¿ªÍ¨µÄSMTP·þÎñ¡£µÇ¼ÓÊÏä -> ÉèÖ㬠²é¿´ÊÇ·ñÖ§³ÖSMTP»òÊÇ·ñ¿ªÆô¡£
3¡¢ÎÊÌ⣺it is no ......
ÔÎÄ£º»ùÓÚ
PHPµÄcURL¿ìËÙÈëÃÅ
Ó¢ÎÄÔÎÄ£ºhttp://net.tutsplus.com/tutorial ... for-mastering-curl/
ÔÎÄ×÷ÕߣºBurak
Guzel
cURL
ÊÇÒ»¸öÀûÓÃURLÓï·¨¹æ¶¨À´´«ÊäÎļþºÍÊý¾ÝµÄ¹¤¾ß£¬Ö§³ÖºÜ¶àÐÒ飬ÈçHTTP¡¢FTP¡¢TELNETµÈ¡£×îˬµÄÊÇ£¬PHPÒ²Ö§³Ö cURL
¿â¡£±¾ÎĽ«½éÉÜ cURL µÄһЩ¸ß¼¶ÌØÐÔ£¬ÒÔ¼°ÔÚPHPÖÐÈçºÎÔËÓÃËü¡ ......
ʵÀýÒ»£ºÎ޲εĴ洢¹ý³Ì
$conn = mysql_connect('localhost','root','root') or die ("Êý¾ÝÁ¬½Ó´íÎó!!!");
mysql_select_db('test',$conn);
$sql = "
create procedure myproce()
begin
INSERT INTO user (id, username, sex) VALUES (NULL, 's', '0');
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproceµÄ´æ´¢¹ý³Ì
......