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£¬Ó¦¸ÃÔÙ½øÐвéѯ¾Í»áÏÔʾ³öÍêÃÀµÄºº×ÖÁË£¡
Ïà¹ØÎĵµ£º
´úÂëÈçÏ£º
<?php
class Book{
static $num=0;
public function showme(){
echo 'ÄúÊǵÚ'.self::$num.'λ·Ã¿Í';
self::$num++;
......
¡¡¡¡»¥ÁªÍøµÄ½ñÌ죬AJAXÒѾ²»ÊÇʲôİÉúµÄ´Ê»ãÁË¡£ËµÆðAJAX£¬¿ÉÄÜ»áÁ¢¼´ÏëÆðÒòRSS¶øÐËÆðµÄXML¡£XMLµÄ½âÎö£¬¿ÖÅÂÒѾ²»ÊÇʲôÄÑÌâÁË£¬ÌرðÊÇPHP5£¬´óÁ¿µÄXML½âÎöÆ÷µÄÓ¿ÏÖ£¬Èç×îÇáÁ¿¼¶µÄSimpleXML¡£²»¹ý¶ÔÓÚAJAXÀ´Ëµ£¬XMLµÄ½âÎö¸üÇãÏòÓÚǰ̨JavascriptµÄÖ§³Ö¶È¡£ÎÒÏëËùÓнâÎö¹ýXMLµÄÈË£¬¶¼»áÒòÊ÷ºÍ½Úµã¶øÍ·´ó¡£²»¿É·ñÈÏ£¬X ......
ÒÔÇ°Ò»Ö±¸ãC++½øÐÐC/S¿ª·¢£¬Ôø¾µÄÏë·¨ÊÇÈç¹ûÓлú»á£¬Ñ§Ñ§¸ãÍøÕ¾ºÍǶÈëʽ¿ª·¢
ûÏëµ½ÕÒµ½¹¤×÷µÄµÚ2Ìì¾ÍÓÐÁË×öÍøÕ¾µÄ»ú»á£¬Ò²×¬µ½ÁË×Ô¼º´óѧÆÚ¼ä×î¸ßµÄÒ»·Ý¹¤×Ê£¬10Ìì1000¿é
ÔÚʲôµÄ¶¼²»»áµÄÇé¿öÏ£¬¾¡È»´ðÓ¦ÈËÊ´¦µÄÀÏʦһ¸öÐÇÆÚдºÃÍøÕ¾µÄºǫ́
ÎÒ³ÐÈÏÕÒµ½¹¤×÷ºó×Ô¼ºÊÇÓеã¿ñÁË£¬ºÜ¶àÊÂûעÒâµ½£¬ºÜ¶àʺó»Ú²»ÁË¡£¡£¡£
......
½ñÌìÒ»´óÔ磬Áìµ¼¸øÎÒ´òµç»°£¬ËµÏµÍ³½ø²»È¥ÁË£¬±¨¸öGot error 28 from storage engineµÄ´íÎó¡£
¿´µ½Õâ¸ö´íÎó£¬Ó¦¸Ã²»ÊÇ×òÌì¸üгÌÐòÔì³ÉµÄ¡£¿´ÆðÀ´ÊÇMYSQL³öÎÊÌâÁË¡£ÓÃmysqlµÄ¿Í»§¶ËÈí¼þnavicat³¢ÊÔÁ¬½ÓÊý¾Ý¿â£¬µÃµ½Í¬ÑùµÄ´íÎó¡£
°Ù¶Èһϣ¬·¢ÏÖÓÐÈËÓöµ½´Ë´íµÄÔÒòÊÇ´ÅÅÌ¿Õ¼äÂúÁË£¬SSHÉϵ½·þÎñÆ÷£¬¹ûÈ»·¢ÏÖ¸ùĿ¼ÒÑÂú¡£Çå ......
mysql Ŀ¼Ï嵀 my.ini ÓÐÁ½´¦ÒªÐÞ¸Ä Ò»´¦ÊÇ [mysql] default-character-set=gbk »¹ÓÐÒ»´¦ÊÇ·ñÈϽ¨±íʱʹÓõÄ×Ö·û¼¯ default-character-set=gbk Á½´¦ÐÞ¸Äһϣ¬ÖØн¨Á¢Êý¾Ý¿âºÍ±íºó¾Í²»»á³öÏÖÂÒÂëÁË¡£ ½¨±íʱҲ¿ÉÒÔÖ¸¶¨Êý¾Ý¿â»ò±íËùʹÓõÄ×Ö·û¼¯ Èç¹û²»ÄÜÖؽ¨Êý¾Ý¿âÔòÖ»ÄÜÔÚÖ¸¶¨µÄÊý¾Ý¿âĿ¼Ï°ѶÔÓ¦µÄ db.opt À ......