½â¾öPHPÖÐÎÄÂÒÂëÎÊÌâ
Ò»£®Ê×ÏÈÊÇPHP ÍøÒ³µÄ±àÂë
1.phpÎļþ±¾ÉíµÄ±àÂëÓëÍøÒ³µÄ±àÂëӦƥÅä
a. Èç¹ûÓûʹÓÃgb2312±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; charset=gb2312")£¬¾²Ì¬Ò³ÃæÌí¼Ó<meta http-equiv="Content-Type" content="text/html; charset=gb2312">£¬ËùÓÐÎļþµÄ±àÂë¸ñʽΪANSI£¬¿ÉÓüÇʱ¾´ò¿ª£¬Áí´æΪѡÔñ±àÂëΪANSI£¬¸²¸ÇÔ´Îļþ¡£
b.Èç¹ûÓûʹÓÃutf-8±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; charset=utf-8")£¬¾²Ì¬Ò³ÃæÌí¼Ó<meta http-equiv="Content-Type" content="text/html; charset=utf-8">£¬ËùÓÐÎļþµÄ±àÂë¸ñʽΪutf-8¡£±£´æΪutf-8¿ÉÄÜ»áÓеãÂé·³£¬Ò»°ãutf-8Îļþ¿ªÍ·»áÓÐBOM£¬Èç¹ûʹÓà session¾Í»á³öÎÊÌ⣬¿ÉÓÃEditPlusÀ´±£´æ£¬ÔÚEditPlusÖУ¬¹¤¾ß->²ÎÊýÑ¡Ôñ->Îļþ->UTF-8Ç©Ãû£¬Ñ¡Ôñ×ÜÊÇɾ³ý£¬ÔÙ±£´æ¾Í¿ÉÒÔÈ¥µôBOMÐÅÏ¢ÁË¡£
2.php±¾Éí²»ÊÇUnicodeµÄ£¬ËùÓÐsubstrÖ®ÀàµÄº¯ÊýµÃ¸Ä³Émb_substr£¨ÐèҪװmbstringÀ©Õ¹£©£»»òÕßÓÃiconvתÂë¡£
¶þ£®PHPÓëMysql µÄÊý¾Ý½»»¥
PHPÓëÊý¾Ý¿â µÄ±àÂëÓ¦Ò»ÖÂ
1.ÐÞ¸ÄmysqlÅäÖÃÎļþmy.ini»òmy.cnf£¬mysql×îºÃÓÃutf8±àÂë
[mysql]
default-character-set=utf8
[mysqld]
default-character-set=utf8
default-storage-engine=MyISAM
ÔÚ[mysqld]ϼÓÈë:
default-collation=utf8_bin
init_connect='SET NAMES utf8'
2. ÔÚÐèÒª×öÊý¾Ý¿â²Ù×÷µÄphp³ÌÐòÇ°¼Ómysql_query("set names '±àÂë'");£¬±àÂëºÍphp±àÂëÒ»Ö£¬Èç¹ûphp±àÂëÊÇgb2312ÄÇmysql±àÂë¾ÍÊÇgb2312£¬Èç¹ûÊÇutf-8ÄÇmysql±àÂë¾ÍÊÇ utf8£¬ÕâÑù²åÈë»ò¼ìË÷Êý¾Ýʱ¾Í²»»á³öÏÖÂÒÂë ÁË
Èý£®PHPÓë²Ù×÷ϵͳÏà¹Ø
Windows ºÍLinux µÄ±àÂëÊDz»Ò»ÑùµÄ£¬ÔÚWindows»·¾³Ï£¬µ÷ÓÃPHPµÄº¯Êýʱ²ÎÊýÈç¹ûÊÇutf-8±àÂë»á³öÏÖ´íÎ󣬱ÈÈç move_uploaded_file()¡¢filesize()¡¢readfile()µÈ£¬ÕâЩº¯ÊýÔÚ´¦ÀíÉÏ´«¡¢ÏÂÔØʱ¾³£»áÓõ½£¬µ÷ÓÃʱ¿ÉÄÜ»á³öÏÖÏÂÃæµÄ´íÎó:
Warning: move_uploaded_file()[function.move-uploaded-file]:failed to open stream: Invalid argument in ...
Warning: move_uploaded_file()[function.move-uploaded-file]:Unable to move '' to '' in ...
Warning: filesize() [function.filesize]: stat failed for ... in ...
Warning: readfile() [function.readfile]: failed to open stream: Invalid argument
Ïà¹ØÎĵµ£º
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/02/04/1-11/
PHPÊý×飨array£©
°ÑÖµÓ³Éäµ½¼üµÄÀàÐÍ¡£
PHP¶ÔÏó£¨object£©
¶ÔÏÖʵÉú»îÖÐÎïÌåµÄÄ£Äâ¡£
PHP¿ÕÖµ£¨null£©
±íʾһ¸öûÓÐÖµµÄÁ¿¡£
ÀýÈç:
¡¡<?php
¡¡¡¡$php = “”;
¡¡¡¡if(isset($a))
¡¡¡¡echo “[1] is NULL<br>”; ......
SimpleTestÊÇÒ»¸öʹÓÃÊ®·Ö¼òµ¥µÄµ¥Ôª²âÊÔ¹¤¾ß¡£
Ò»ÏÂÄÚÈÝÊÇÎÒ×Ô¼ºÉè¼ÆµÄÀûÓÃSimpleTest¶ÔÒ»¸öÏîÄ¿½øÐе¥Ôª²âÊԵĴúÂë
Ò»¡¢Îļþ½á¹¹
Ò»¸öÏîÄ¿Óжà¸öÎļþ¼Ð£¬Îļþ¼ÐÖл¹°üº¬Îļþ¼Ð¡£ÎÒÃÇÒª½øÐвâÊԵĴúÂë¼´°üº¬ÔÚÕâЩÎļ ......
ÕâÀïҲǿÁÒÍƼöYII¿ò¼Ü£¬Õâ¸öÄêÇáµÄ¿ò¼ÜÓÉÃÀ¹ú»ªÈË¿ª·¢£¬Ãû½ÐѦǿ¡£Yii FramworkÊÇ2009×î¼ÑPHP¿ò¼Ü¡£
Yii ÊÇÒ»¸ö»ùÓÚ×é¼þ¡¢ÓÃÓÚ¿ª·¢´óÐÍ Web Ó¦ÓõĸßÐÔÄÜ PHP ¿ò¼Ü¡£Ëü½« Web ±à³ÌÖеĿÉÖØÓÃÐÔ·¢»Óµ½¼«Ö£¬Äܹ»ÏÔÖø¼ÓËÙ¿ª·¢½ø³Ì¡£Yii£¨¶Á×÷“Ò×”£©´ú±í¼òµ¥(easy)¡¢¸ßЧ( ......
http://topic.csdn.net/t/20040927/15/3412922.html
http://www.docin.com/p-23414672.html
http://www.qqread.com/php/n652282101.html
http://www.51testing.com/?uid-65519-action-viewspace-itemid-142987
1 apacheÅäÖÃÎļþhttpd.conf×îááÌí¼Ó:
LoadModule php6_module "c:/php6/php6apac ......