PHP+MySQLÂÒÂëµÄ½â¾ö
ÔÚDOSÖнøÐÐMySQLµÄ·ÃÎÊ¿ÉÄÜÂÒÂëµÄÇé¿öÓÐÈýÖÖ£¬
Ê×ÏÈ£¬Òª×öµÄÊǼì²éMySQLµÄÅäÖ㬰²×°µÄʱºòÑ¡Ôñutf-8µÄÓïÑÔ»·¾³»áʡȥºÜ¶àµÄÂé·³
1. ¼ì²éMySQLµÄ·þÎñ¶Ë¡¢¿Í»§¶ËµÄÓïÑÔÉèÖÃÊÇ·ñΪ“utf8”£¬²»ÊǵϰÊÖ¶¯½«my.int¸ü¸Ä¹ýÀ´£»
2. ÔÚPHP½øÐеÚÒ»´Îmysql_query֮ǰÉèÖÃʹÓÃÁ¬½ÓµÄ×Ö·û¼¯Îª"SET NAMES 'utf8'"£¬¼´mysql_query("SET NAMES 'utf8'");ºÜ¶àÈË×öµ½ÕâÀï¾Í¿ÉÒÔ¿´µ½ºº×ÖÁË£»
3. ÉèÖÃdatabaseµÄ×Ö·û¼¯——ÀýÈ磬CREATE DATABASE dmsdb DEFAULT CHARACTER SET utf8 COLLATE utf8_bin£¬ÕâÑùʹÓÃshow full column from tablename²éµ½µÄVARCHARµÄCOLLATE²ÅÊÇutf8_binÀàÐ͵ģ»
Æä´Î£¬Ó¦¸Ã·¢ÏÖÔٴβéѯµÄ½á¹û×Ö·û´®ÓÐÁ˱仯£¬ÕâʱÈç¹ûÓÐÐí¶àµÄÈÕÎÄ×Ö·û³öÏÖ£¬ÔÙ¿´PHP.iniµÄÉèÖãº
phpÖÐÒª¶Ôphp.iniÎļþÖÐline 637: extension=php_mbstring.dll ǰµÄ·ÖºÅ³ýµô£¬²¢ÇÒ±ØÐèÐÞ¸Ämb_stringµÄÏà¹Ø±àÂëÅäÖã¬Ð޸ĺóµÄÄÚÈÝΪ£º
line 1164: mbstring.language = utf-8
line 1169: mbstring.internal_encoding = utf-8
line 1172: mbstring.http_input = auto
line 1176: mbstring.http_output = utf-8
line 1183: mbstring.encoding_translation = On
line 1187: mbstring.detect_order = auto
line 1191: mbstring.substitute_character = utf-8;
line 1201: mbstring.func_overload = 1
£¨ËùÓÐÐкžù¶ÔÓ¦µÄÊÇphp5.1.6 °æ±¾µÄphp.ini-recommand£©
µ±´ËʱÉèÖÃÍê³ÉºóÎÒÔÚdosÀï½øÐвéѯ²Ù×÷»¹ÊÇ»á³öÏÖÂÒÂëµÄÐÎʽ£¬ÕâʱҪ¿¼ÂÇdosµÄÉèÖÃÎÊÌâÁË£¬
ÔÚShell>mysql --default-character-set=gbk -u root -p£¬Ó¦¸ÃÔÙ½øÐвéѯ¾Í»áÏÔʾ³öÍêÃÀµÄºº×ÖÁË£¡
Ïà¹ØÎĵµ£º
/**********************************
APACHE
***********************************/
±à¼²ÎÊý£º
./configure" \
"--prefix=/usr/local/apache" \
"--enable-so" \
"--enable-ssl" \
"--enable-mods-shared=most" \
"--with-mpm=event" \
"--with-ssl=/usr/local/openssl" \
"--enable-cache" \
"--enable-mem- ......
Ö´ÐÐÒÔÏÂÓï¾ä£º
var_dump(2147483647); // int
var_dump(
2147483648); // float
¿ÉÒÔ¿´µ½£¬php intÐ͵Ä×î´óÖµ¾ÍÊÇ
2147483647£¬¼´231
-1£¬ÒòΪ32λµÄ×î¸ßλҪÓÃÀ´±íʾÕý¸º¡£
ÔÙÖ´ÐÐÒÔÏÂÓï¾ä£º
$u = sprintf("%u",
2147483648); # ¸ü»»Îª%b,%dÊÔÊÔ
var_dump($u);
......
×î½ü¹¤×÷·¶³ëÓÉÔÀ´µÄ.netÇл»µ½ÁËphp£¬×ÛºÏÕâ¶Îʱ¼äµÄÈÏÖª£¬¾õµÃÔÚphpÕâ¸öÌåϵÖÐMVCģʽδ±ØÊÇÒ»¸öºÃ¶«Î÷¡£
´ÓijÖÖÀíÂÛÉÏÀ´Ëµ,MVCȷʵ¿ÉÒÔÈÃϵͳ¸üÇåÎúºÍ¸üÃ÷ÁË¡£
µ«ÊÇÒ»¸öºÜÖØÒªµÄÒ»µãÒ²´æÔÚÁË£¬MVCÈÃÒ³Ãæ¸ü¶àÁËÆðÀ´£¡£¡£¡ÕâµãºÜÖØÒª
PHPÔÚûÓÐÒ»¸ö±È½ÏºÃµÄIDEµÄÖ§³ÖÏ£¬Ò³ÃæÌø×ªºÍÇл»ÊµÔÚÊǷdz£²»·½±ã¡£
ûÓÐÒ»¸öºÃ ......
ÔÚʵ¼Ê¿ª·¢¹ý³Ì»á¾³£»áÓöµ½Ò»Ð©Öظ´µÄ²Ù×÷£¬Èç¹ûÿ´Î¶¼Òª×Ô¼ºÈ¥ÊµÏÖÕâÎÞÒɼÓÖØÁË×Ô¼ºµÄ¹¤×÷Á¿£¬ÏÂÃæ¶ÔһЩ¿ÉÄܾ³£Óõ½µÄÀà×ö¸öÕûÀí£º
ͼ±í¿â
ÏÂÃæµÄÀà¿â¿ÉÒÔÈÃÄãºÜ¼òµ¥¾ÍÄÜ´´½¨¸´ÔÓµÄͼ±íºÍͼƬ¡£µ±È»£¬ËüÃÇÐèÒªGD¿âµÄÖ§³Ö¡£
pChart - Ò»¸ö¿ÉÒÔ´´½¨Í³¼ÆÍ¼µÄ¿â¡£
Libchart - ÕâÒ²ÊÇÒ»¸ö¼òµ¥µÄͳ¼ÆÍ¼¿â¡£
JpGraph - Ò» ......
mysql Ŀ¼Ï嵀 my.ini ÓÐÁ½´¦ÒªÐÞ¸Ä Ò»´¦ÊÇ [mysql] default-character-set=gbk »¹ÓÐÒ»´¦ÊÇ·ñÈϽ¨±íʱʹÓõÄ×Ö·û¼¯ default-character-set=gbk Á½´¦ÐÞ¸Äһϣ¬ÖØÐ½¨Á¢Êý¾Ý¿âºÍ±íºó¾Í²»»á³öÏÖÂÒÂëÁË¡£ ½¨±íʱҲ¿ÉÒÔÖ¸¶¨Êý¾Ý¿â»ò±íËùʹÓõÄ×Ö·û¼¯ Èç¹û²»ÄÜÖØ½¨Êý¾Ý¿âÔòÖ»ÄÜÔÚÖ¸¶¨µÄÊý¾Ý¿âĿ¼Ï°ѶÔÓ¦µÄ db.opt À ......