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

PHP±àÂëÎÊÌâ

ÀÏÉù³¤Ì¸£¬×ÅÊÇÀ§»óºÜ¶àÈ˵ÄÎÊÌ⣬Èç¹û´¦Àí²»ºÃ£¬¶¼ÊÇÂÒÂ룬˵ÕâЩ»°²¢²»ÊÇÎÒ¶Ô±àÂëºÜ¾«Í¨£¬Ö»ÊÇÔÚÕâ·½ÃæÊǵÃÁôÉñ£¬×Ô¼º×ܽáÁËÒ»µãС¾­Ñé(ÈÝÒ׳öÏÖÂÒÂëµÄµØ·½ÓÐphpÎļþÀïÃ棬Êý¾Ý¿âÀïÃ棬ҳÃæÏÔʾ):
1.ÔÚÓÚÊý¾Ý´ò½»µÀµÄʱºòmysql_query("set names 'utf-8'");
2.ÔÚ½¨Êý¾Ý¿âµÄʱºò£¬ÓÈÆäÊÇÓÃphpMyAdminÓëMYSQL´ò½»µÀʱºò£¬Ò»°ã¶¼ÊÇutf-8
3.PHPµÄÎļþĬÈϵıàÂëÊÇANSI£¬ÐèҪת»»ÎªUTF-8£¬ÖÁÓÚÔõôת»»editplus¾ÍÓÐÕâÑùµÄ¹¦ÄÜ£¬“Áí´æΪ”µÄʱºòÓÐÑ¡Ôñ±àÂ룬»¹ÓÐÓеÄÈËÔÚeclipseÀïÃ濪·¢£¬eclipseÀïÃæĬÈϵÄÊÇISO-8859-1,ÐèÒªÔÚ“´°¿Ú”->“Ê×Ñ¡Ïî”´ò¿ª“Ê×Ñ¡Ïî”´°¿Ú£¬ÔÚ×ó²à“³£¹æ”->“¹¤×÷¿Õ¼ä”£¬ÔÚ“Îı¾Îļþ±àÂë”ÀïÃæÉèÖÃĬÈϵıàÂë
4.¾ÍÊÇPHPÎļþÀïÃæҪ˵Ã÷£ºÈç<meta http-equiv="Content-Type" Content="text/html;charset=utf-8">
//±àÂëת»»
function display_fileencoding($filename)
{
if(extension_loaded("mbsting"))
{
$code=mb_detect_encoding($filename);//¼ì²â×Ö·û´®±àÂë
$filename=mb_convert_encoding($filename,"UTF-8",$code);//½«±àÂë$codeת»»Îªutf-8±àÂë
return $filename;
}
else
die("Çë¼ì²éϵͳÊÇ·ñÕýÈ·°²×°ÅäÖÃmbstring");
}

Ҫȷ±£mbstringÔÚÄãµÄphp.iniÖÐÆôÓÃ
6.»¹ÓоÍÊÇ´¦ÀíÖÐÎĵÈË«×Ö½ÚµÄʱºòÒ²ÓпÉÄܳöÏÖÂÒÂ룬PHPÀïÃæ¿ÉÒÔ²ÉÓõÄÓÐiconv,mb_convert_encodingÀ´´¦ÀíË«×Ö½Ú£¬ÆäÓàµÄ¿ÉÒԲο¼PHP°ïÖúÊÖ²á
7.±£Ö¤ÒÔÉϼ¸´¦±àÂëÒ»Ö¾ͿÉÒÔÁË£¡£¡ÈçÓв»¶ÔµÄ£¬ÇëÁôÑÔÖ¸³ö£¡£¡
5.ÔÚ²¹³äÒ»µã£¨ÒÅ©µÄÒ»µã£©£¬ÔÚÄãµÄ³ÌÐòÀïÃæÄãÒªÖªµÀÊý¾ÝÖ®¼äµÄ´«µÝÒ²ÓпÉÄÜ´æÔÚ±àÂëÎÊÌâµÄ£¬µ«ÊÇÄãÓв»ÖªµÀ´«µÝ¹ýÀ´µÄÊý¾ÝÊDzÉÓõÄʲô±àÂ룬ÔÚPHPÀïÃæÌṩÁË·½·¨À´´¦ÀíµÄ£¬ÏÂÃæÊÇ×Ô¼ºÐ´µÄÒ»¸ö¼òµ¥·½·¨£¬¿ÉÒԲο¼Ò»ÏÂ


Ïà¹ØÎĵµ£º

PHPÍæתMySQLÖ®Íâ¼üÔ¼Êø ÄÏÈý·½

ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Ñ§Ï°ÈçºÎͨ¹ýPHP 5µÄÒ»¸ö»ù±¾³éÏóÀàʹÓÃÍâ¼üÔ¼ÊøÀ´¸üÐÂÁ½¸öInnoDB±íµÄÊý¾Ý¡£ ÎÒÃǽ«Í¨¹ý¾ßÌåʾÀýÀ´ËµÃ÷ÈçºÎͨ¹ý·þÎñÆ÷¶Ë½Å±¾ÓïÑÔÀ´Ê¹ÓÃÍâ¼üÔ¼Êø¡£
¡¡¡¡Ò»¡¢ÀûÓÃÍâ¼üÔ¼Êø¸üÐÂMySQLÖеÄÊý¾Ý
¡¡¡¡ÏÖÔÚ£¬×îÁ÷ÐеĿªÔ´¹ØϵÐÍÊý¾Ý¿â¹ÜÀíϵͳ·ÇMySQLĪÊô£¬¶øMySQLÓÖÖ§³Ö¶à¸ö´æ´¢ÒýÇ棬ÆäÖÐĬÈϵÄÒ²ÊÇËٶȽϿìµÄ´ ......

ÊÕ²ØPHP³£Óú¯ÊýÊÕ¼¯

<?
function GetIP() { //»ñÈ¡IP
if ($_SERVER["HTTP_X_FORWARDED_FOR"])
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if ($_SERVER["HTTP_CLIENT_IP"])
$ip = $_SERVER["HTTP_CLIENT_IP"];
else if ($_SERVER["REMOTE_ADDR"])
$ip = $_SERVER["REMOTE_ADDR"];
......

3.2.5 PHPÀà³£Á¿µÄ¾ÖÏÞ

    Èç¹ûÀà³£Á¿ÄÜÍêÈ«ÌýÃüÓÚÎÒÃÇ(do our bidding)»¹ÊÇÏ൱²»´íµÄ£¬µ«ÊÇÆ䲻ѱ֮´¦»¹ÊÇÔçÔçµØ±©Â¶³öÀ´ÁË¡£Àà³£Á¿µÄÖµÖ»ÄÜÔÚ¶¨ÒåʱÉèÖ㬲¢ÇÒ²»ÄÜÔÚÀàµÄ·½·¨Öж¨Òå¡£³£Á¿Ö»Äܱ»³õÉè³ÉÆÕֵͨ(plain value)²»Äܱ»ÉèÖóɶÔÏó¡£ÉõÖÁÔÚ¶¨ÒåÀà³£Á¿Ê±£¬²»ÄÜʹÓÃ×Ö·ûÁ¬½Ó¡£
    ÕýÈçÇ°ÃæÌáµ½µÄ£¬²»Äܸ ......

PHPÊÇʲô

PHP£¬Ò»¸öǶÌ×µÄËõдÃû³Æ£¬ÊÇÓ¢Îij¬¼¶Îı¾Ô¤´¦ÀíÓïÑÔ£¨PHP:Hypertext Preprocessor£©µÄËõд¡£PHP ÊÇÒ»ÖÖ HTML ÄÚǶʽµÄÓïÑÔ£¬PHPÓë΢ÈíµÄASPÆÄÓм¸·ÖÏàËÆ£¬¶¼ÊÇÒ»ÖÖÔÚ·þÎñÆ÷¶ËÖ´ÐеÄǶÈëHTMLÎĵµµÄ½Å±¾ÓïÑÔ£¬ÓïÑԵķç¸ñÓÐÀàËÆÓÚCÓïÑÔ£¬ÏÖÔÚ±»ºÜ¶àµÄÍøÕ¾±à³ÌÈËÔ±¹ã·ºµÄÔËÓá£PHP ¶ÀÌصÄÓï·¨»ìºÏÁË C¡¢Java¡¢Perl ÒÔ¼° PHP ×Ô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ