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

Php²É¼¯ÈÃÄãµÄÕ¾¸úÐÂÀËÍøµÄÐÂÎű£³Öͬ²½.doc

   ²É¼¯ÒѾ­²»ÊÇʲôÐÂÃû´ÊÁË,ºÜ¶àÕ¾³¤ÎªÁËÊ¡ÊÂ,Ò²¾ÖÏÞÓÚÈËÁ¦µÄȱ·¦,ʹÓóÌÐòÀ´¸ø×Ô¼º
µÄÍøÕ¾Ìíש¼ÓÍß,±ÈÈç±¾È˵ĸöÈËÍøÕ¾Î÷Î÷¸¥Ë¹ÍøÒ²²É¼¯ÁË´óÁ¿µÄÐÂÎÅ,ÄÇôÈç¹ûʵÏÖÄØ?½ñÌìÎÒÃÇÔËÓÃphpÀ´ÊµÏÖÕâ¸ö¹¦ÄÜ.
   ̸µ½²É¼¯,ÎÒÃDz»µÃ²»ËµÁ½¸ö¶«Î÷,µÚÒ»¸öÊÇÈçºÎ»ñÈ¡Ô¶³ÌÍøÕ¾µÄÔ´´úÂë,Õâ¸ö¿ÉÒÔͨ¹ýphpµÄÒ»¸öÀ©Õ¹curlÀ´»ñÈ¡,ÁíÒ»¸öÊÇÈç¹ûȥƥÅäÄãÐèÒªµÄÐÅÏ¢,Õâ¸öµÄ½â¾ö°ì·¨ÊÇÕýÔò±í´ïʽ.
  WindowsÏ¿ªÆôcurlµÄ·½·¨ÈçÏÂ:
1¡¢¿½±´PHPĿ¼ÖеÄlibeay32.dll, ssleay32.dll, php5ts.dll, php_curl.dllÎļþµ½ system32 Ŀ¼¡£
2¡¢ÐÞ¸Äphp.ini£ºÅäÖúà extension_dir £¬È¥µô extension = php_curl.dll Ç°ÃæµÄ·ÖºÅ¡£
3¡¢ÖØÆðapache¡£
   LinuxÏ¿ªÆôcurlµÄ·½·¨ÈçÏÂ:
½øÈë°²×° Ô­php µÄÔ´ÂëĿ¼£¬
cd ext
cd curl
phpize
./configure --with-curl =DIR
make
¾Í»áÔÚPHPDIR/ext/curl /moudles/ÏÂÉú³Écurl .soµÄÎļþ¡£
¸´ÖÆcurl .soÎļþµ½extensionsµÄÅäÖÃĿ¼£¬ÐÞ¸Äphp .ini¾ÍºÃÁË.
   È»ºóÄã¾Í¿ÉÒÔÀûÓÃcurlÀ´»ñÈ¡µ½Ö¸¶¨urlµÄÍøÒ³Ô´ÂëÁË,ÕâÀï¸ø´ó¼ÒÒ»¸ö·â×°ºÃµÄº¯Êý:
function getwebcontent($url){
       $ch = curl_init();
       $timeout = 10;
       curl_setopt($ch, CURLOPT_URL, $url);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
       curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
       $contents = trim(curl_exec($ch));
       curl_close($ch);
       return $contents;
}
   ½ÓÏÂÀ´¾ÍÓ¦¸Ã˵µ½phpÖеÄÕýÔò±í´ïʽÁË:
1.ÖÐÀ¨ºÅ
[0-9]Æ¥Åä0-9 
[a-z]Æ¥Åäa-zСд×Öĸ 
[A-Z]Æ¥ÅäA-Z´óд×Öĸ 
[a-zA-Z]Æ¥ÅäËùÓдóСд×Öĸ 
¿ÉÒÔʹÓÃasciiÀ´Öƶ¨¸ü¶à
2.Á¿´Ê
p+Æ¥ÅäÖÁÉÙÒ»¸öº¬pµÄ×Ö·û´® 
p*ÅãÅãÈκΰüº¬0¸ö»ò¶à¸öpµÄ×Ö·û´® 
p?Æ¥ÅäÈκΰüº¬0¸ö»òÒ»¸öpµÄ×Ö·û´® 
p{2}Æ¥Åä°üº¬2¸öpµÄÐòÁеÄ×Ö·û´® 
p{2,3}Æ¥ÅäÈκΰüº¬2¸ö»ò3¸öµÄ×Ö·û´®


Ïà¹ØÎĵµ£º

PHP´éÍøÕ¾Ò»¸ö

ΪÁËÓ¦¸¶Êý×ÖýÌåʵ¼ùСѧÆÚ£¬ÓÃÁ½ÈýÌìµÄʱ¼ä´Ò´ÒææµØ¼ÜÆðÀ´Ò»¸öPHPÍøÕ¾¡£ÍøÕ¾ºÜ´é£¬ÀÏʦ¸øµÄ·ÖÊýÈÃËü¿´ÆðÀ´¸ü´é¡£
×öÕâ¸öÍøÕ¾µÄÄǶÎʱ¼äÕýºÃÔÚ¿´BrooksµÄÄDZ¾¿õÊÀ¾­µä¡¶ÈËÔÂÉñ»°¡·£¬Á˽âÁËÆäÖеēThe Surgical
Team”µÄ¿ª·¢Ä£Ê½£¬¾õµÃÔÚÌØÊⳡºÏÏ£¬ÕâÖÖ¿ª·¢Ä£Ê½È·Êµ»áÓµÓм«¸ßµÄ¿ª·¢Ð§ÂʺÍÍŶÓÕ½¶·Á¦¡£
Ò ......

php ʹÓÃmemcached °²×°ÅäÖÃ

 
1¡¢°²×°libeven
memcachedµÄʹÓÃÐèÒªlibevenµÄÖ§³Ö£¬ÎÒÃǵÃÏÈ×°ÉÏlibeven¡£
¹Ù·½ÍøÕ¾£ºhttp://www.monkey.org/~provos/libevent/
libevent°²×°·½Ê½±È½Ï¼òµ¥:
./configure && make
make install
¼ì²éÊÇ·ñ ÒѾ­°²×°
 ls -l /usr/local/lib/ | grep even
2¡¢°²×°memcached
¹Ù·½ÍøÕ¾£ºhttp://ww ......

PHPÖÐʹÓÃstrip_tags() È¥³ýhtml±êÇ©

 
ƽʱÓà htmlspecialchars() À´¹ýÂËhtml, µ«ÊÇ°ÑhtmlµÄ×Ö·ûתÒåÁË,×îºóÏÔʾ³öÀ´µÄ¾ÍÊÇhtmlÔ´´úÂë, ÀûÓÃstrip_tags()¾Í¿ÉÒÔ°Ñhtml±êÇ©È¥³ýµô.
[php]
$str = 'harryxu
‘;
echo(htmlspecialchars($str) . ‘
‘);
echo(strip_tags($str));
// output:
// harryxu
// harryxu
?> 
......

php´úÂëÓÅ»¯

 ÏÂÃæÕâһС¶Î“ÁÓÖÊ”µÄPHP´úÂëÊÇÒ»µÀ¼ò»¯Á˵IJâÊÔÌâ¡£ÕâÖÖÎÊÌâ¾ÍÏñÔÚÎÊ£ºÄã¸ÃÔõÑùÓÅ»¯Õâ¶Î´úÂ룿
<?
echo(”<p>Search results for query: ” .
    $_GET['query'] . “.</p>”);
?>
¡¡¡¡Õâ¶Î´úÂëµÄÖ÷ÒªÎÊÌâÔÚÓÚËü°ÑÓû§Ìá½»µÄÊý¾ÝÖ±½ÓÏÔʾµ½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ