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À´Íê³ÉÕâÒ»Çкܼòµ¥£¬µ«ÐèҪעÒâµÄÊÇÈç¹ûÏëÔÚÒÔºóµÄÒ³ÃæÖж¼ÄÜÈ·ÈÏÓû§Éí·Ý¡£
µÚÒ»²½ÊÇ×öÒ»¸öµÇ¼µÄÒ³Ãæ¡£
µÚ¶þ²½¿ªÊ¼µÇ¼ºóµÄÈ·ÈϳÌÐòµÄÉ ......
1.Ö±½ÓʹÓÃmysql_insert_id()»ñÈ¡ÉÏÒ»´Î²åÈëµÄÊý¾ÝµÄAUTO_INCREMENTµÄ±äÁ¿µÄ±àºÅ£¬±ÈʹÓÃmysqlÓï¾ä»ñÈ¡·½±ã¼«¶à¡£µ«×¢ÒâÒªÔÚquery()ºóÁ¢¿ÌʹÓ㬱£Ö¤Ê±¼äÕýÈ·ÐÔ£¬Èç¶àÏ̷߳ÃÎÊÊý¾Ý¿âÊDzúÉúÎó²î¡£
2.µÈºÅ×óÓÒ¸÷ÁôÒ»¿Õ¸ñ£¬ÇåÎú±ãÓÚÔĶÁ¡£
3.PHPÖУ¬µ¥Ë«ÒýºÅ¾ù¿ÉÒÔÌ×string£¬Çø±ðÔÚÓÚ£º
"this is a simple $test" = 'this i ......
PHP³ÌÐòÔ±µÄÊ®¸ö½¨ÒéÐÔ¼¼ÇÉ
2009-07-11 09:46
Ò»¸öͬÑùµÄ¹¦ÄÜ,¸÷ÖÖ³ÌÐòÓïÑÔ´ó¶àÄÜʵÏÖ.¾ÍËãÒ»ÖÖÓïÑÔ,Ò²ÓкܶàÖÖʵÏÖ·½·¨.¸÷ÖÖ·½·¨¸÷Óи÷µÄºÃ»µ.
¶ÔÓÚPHP
±È½Ï³£¼ûµÄ¼¸¸ö³ÌÐòʹÓÃÎÊÌâ.±¾ÎÄ×ܽáһЩPHP³ÌÐòÔ±µÄÊ®¸ö½¨ÉèÓë¼¼ÇÉ,¹©´ó¼Ò²Î¿¼.
¡¡¡¡1.ʹÓà ip2long() ºÍ ......
Õâ¶Îʱ¼äÔÚ¿´¡¶PHPºÍMySQL Web¿ª·¢¡·Ò»Êé¿´µ½str_replace½²½â£¬Ò»¶ÎСÌáʾдµ½£º¿ÉÒÔΪstr_replaceµÄÈý¸ö¶¼Ê¹ÓÃÊý×é´«È룬µ«½²½â±È½Ï¼òµ¥£¬ÓÚÊǾö¶¨×Ô¼ºµÄÊÔÑéһϸú¯ÊýÔÚ¸÷¸ö²ÎÊý´«ÈëÊý×éʱµÄÖ´Ðнá¹û¡£
º¯ÊýÔÐÍ£ºmixed str_replace(mixed needle,mixed new_needle,mixed haystack[,int &count]);
needle£ ......