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

PHP ͨ¹ýcurl¿âº¯Êý»ñÈ¡ÍøÒ³ÄÚÈÝ


function get_web_page( $url )
{
$options = array(
CURLOPT_RETURNTRANSFER => true,     // return web page ·µ»ØÍøÒ³
CURLOPT_HEADER         => false,    // ²»·µ»ØÍ·ÐÅÏ¢
CURLOPT_FOLLOWLOCATION => true,     // follow redirects
CURLOPT_ENCODING       => "",       // handle all encodings
CURLOPT_USERAGENT      => "spider", // ÉèÖÃUserAgent
CURLOPT_AUTOREFERER    => true,     // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect Á¬½Ó³¬Ê±
CURLOPT_TIMEOUT        => 120,      // timeout on response »Ø¸´³¬Ê±
CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
);
$ch      = curl_init( $url );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$err     = curl_errno( $ch );
$errmsg  = curl_error( $ch );
$header  = curl_getinfo( $ch );
curl_close( $ch );
$header['errno']   = $err;
$header['errmsg']  = $errmsg;
$header['content'] = $content;
return $header;
}


Ïà¹ØÎĵµ£º

³õѧPHPµÄ18¸ö»ù´¡Àý³Ì

 
ÈçºÎ´´½¨ÎÒÃǵĵÚÒ»¸öPHPÒ³ÃæÄØ£¿·Ç³£¼òµ¥µÄ£¡Ñ¡ÔñÎÒÃÇʹÓõÄÒ»¸ö×îºÃµÄÉè¼Æ¹¤¾ß£¬µ±È»ÄãÒ²¿ÉÒÔ Ö»Ê¹ÓüÇʱ¾¡£´´½¨Ö®ºó¼ÇµÃÒª±£´æΪÀ©Õ¹ÃûΪPHPµÄÎļþ£¬È»ºó´«µ½ÎÒÃǵķþÎñÆ÷
ÉÏ¡£
¡¡¡¡ÔÚ±àдPHP³ÌÐò֮ǰͨ³£ÎÒÃÇÐèÒªÅäÖÃÎÒÃǵĻ·¾³£¬Ò²¾ÍÊÇ˵·þÎñÆ÷
ÒªÖ§³ÖPHP²ÅÄÜÐа¡
¡¡¡¡Ò»¡¢PHPµÄ»ù±¾½á¹¹£º
¡¡¡¡Ê¹ÓÃIncl ......

php»ñÈ¡»·¾³ÐÅÏ¢

ϵͳ°æ±¾±È½Ï
mixed version_compare ( string version1, string version2 [, string operator] )
version_compare('5.1','<');  //±È½Ïµ±Ç°°æ±¾ÊÇ·ñСÓÚ5.1
ÊÇ·ñ¿ªÆô×Ô¶¯/
get_magic_quotes_gpc() 
return 1 on: will add slash.
return 0 off:willn't add.
if(get_magic_quotes_gpc()) {
 $cm ......

PHPѧϰ±Ê¼Ç

1.Ö±½ÓʹÓÃmysql_insert_id()»ñÈ¡ÉÏÒ»´Î²åÈëµÄÊý¾ÝµÄAUTO_INCREMENTµÄ±äÁ¿µÄ±àºÅ£¬±ÈʹÓÃmysqlÓï¾ä»ñÈ¡·½±ã¼«¶à¡£µ«×¢ÒâÒªÔÚquery()ºóÁ¢¿ÌʹÓ㬱£Ö¤Ê±¼äÕýÈ·ÐÔ£¬Èç¶àÏ̷߳ÃÎÊÊý¾Ý¿âÊDzúÉúÎó²î¡£
2.µÈºÅ×óÓÒ¸÷ÁôÒ»¿Õ¸ñ£¬ÇåÎú±ãÓÚÔĶÁ¡£
3.PHPÖУ¬µ¥Ë«ÒýºÅ¾ù¿ÉÒÔÌ×string£¬Çø±ðÔÚÓÚ£º
"this is a simple $test" = 'this i ......

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дһ¸ö×Ô¼ºµÄÄ£°åÒýÇæ
2009-07-11 09:51
SmartyÒ»Ö±±»ÈËÊÓΪÊǶàÓàµÄ¶«Î÷£¬ÎÒ¾õµÃÈÏΪSmarty¶àÓàµÄÈ˲ÅÊǶàÓàµÄ....²»ËµÕâЩÁË¡£½ñÌìÎҾͽ̴ó¼Òд¸öÄ£°åÒýÇ棬Èôó¼Ò¶¼¿ÉÒÔдһ¸öÊôÓÚ×Ô¼ºµÄÄ£°åÒýÇ棬¶øÇÒ¿´ÍêÕâƪÎÄÕÂÖ®ºó£¬Äã¶ÔSmartyµÄÈÏʶ»á¸ü½øÒ»²½µÄ¡£ÎÒµÄÄ£°åÒýÇæÃû½ÐStupid£¨"ɵ¹Ï"µÄÒâ˼£©£¬ÎÒ²»Ï ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ