php ÂÒÂë - PHP / »ù´¡±à³Ì
Êý¾Ý¿âÉèÖÃΪutf8,phpÒ³ÃæÎļþÒ²ÉèÖÃΪutf-8,½øÐвéѯµÄʱºò³öÏÖÂÒÂ룬±ÈÈç×Öĸa»áÆ¥ÅäÖÐÎÄ£¬Ôõô½â¾öÄØ£¿
set names ÄØ£¿ÊDz»ÊÇÄãµÄ¡£htmlÒ³Ãæ±àÂëÎÊÌâ°¡
html±àÂëÒ²ÊÇutf-8µÄ<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
ºÜÆæ¹ÖµÄÊÇ$keywords = iconv("utf-8", "gb2312", $keywords);ÕâÑùתÂëÖ®ºó£¬ÖÐÎÄ¿ÉÒÔÆ¥Å䣬µ«ÊÇ×Öĸ¿ÉÄÜ»áÆ¥Åäµ½ÖÐÎÄ¡£
ËÄÜ°ï棿
µ«ÊÇ×Öĸ¿ÉÄÜ»áÆ¥Åäµ½ÖÐÎÄ
ʲôÒâ˼£¬Ò»Ö±²»¶®Õâ¾ä»°Ê²Ã´Òâ˼
±ÈÈçÎÒËÑË÷ʱÊäÈëÒ»¸ö×Öĸa,µ«ÊÇÆ¥Åäµ½µÄÄÚÈÝÊÇÖÐÎÄ
¶÷£¬Í¦ÉñÆæµÄ
Êý¾Ý¿âÀïÃæµÄÖÐÎIJ»ÄÜÕý³£ÏÔʾ£¬»áÓÐÀàËÆaµÄ×Ö·û
ÊÔϼÓÉÏ
mysql_select_db(".........")//ÕâÒ»¾äºóÃæÖ´ÐÐÒ»´ÎÏÂÃæÕâ¾ä
mysql_query("SET NAMES 'utf8'");
Ò³Ãæµ÷ÓÃÁËJavaScript»òajaxµÈ´¦ÀíÊý¾ÝÂ𣬿ÉÄÜÎÊÌâ¾Í³öÕâ¡£¡£
Ò³Ãæµ÷ÓÃÁËJavaScript»òajaxËü¾³£³ö£¬»òÕß˵ֻҪ²»ÊÇutf-8µÄ»°¿Ï¶¨³öÂÒÂ룬´«¹ýÈ¥ºóÓÃiconv()תϾͺÃÁË
Êý¾Ý¿âÀïÖÐÎIJ»ÄÜÕý³£ÏÔʾ£¿ ÊDz»ÊÇÊý¾Ý¿âÖ§³ÖÖÐÎÄûÓÐÉèÖã¿
show create database faq;
µÃµ½CREATE DATABASE `faq` /*!40100 DEFAULT CHARACTER SET utf8 */
ËùÒÔÊý¾Ý¿âµÄ±àÂëÊÇutf8µÄ£¬µ«ÊDzéѯÊý¾Ý¿âÀïÃæµÄÊý¾ÝÊÇÂÒÂ룬¶øÒ³ÃæÓÖ¿ÉÒÔÏÔʾ³ÉÖÐÎÄ£¬Ôõô»áÕâÑùÄØ£¿
Ö»ÒªÒ³Ãæ+php+mysql ¶¼ÊÇutf8µÄ£¬Ó¦¸ÃûÎÊÌâ¡£
ÄãµÄÄÇaÊDz»ÊÇÈ«½ÇµÄ°¡£¿ ×îºÃ°ÑSQL´òÓ¡³öÀ´£¬È»ºóÔÚºǫ́ÔËÐÐÒ»ÏÂÄǸöSQL ¿´¿´²éѯ³öÀ´Ê²Ã´½á¹û¡£
ĬÈÏÇé¿öÏ£¬MySQLÔÚÖ´ÐвéÕÒʱ²»Çø·Ö×ÖĸµÄ´óСд¡£µ±ÄãÔ
Ïà¹ØÎÊ´ð£º
mssql_select_db("f1",mssql_connect("localhost","sa","sa"));
mssql_select_db("f2",mssql_connect("192.168.0.1","sa","sa") ......
Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Çý¶¯³ÌÐò¹ÜÀíÆ÷] δ·¢ÏÖÊý¾ÝÔ´Ãû³Æ²¢ÇÒδָ¶¨Ä¬ÈÏÇý¶¯³ÌÐò, SQL state IM002 in SQLConnect in D:\0\msc\msc\tel.php on line 44
Í ......
ÏÖÓÐÒ»PHP¿Õ¼ä£¬Ö§³ÖMYSQLÊý¾Ý¿â
Ϊ½ÚÊ¡·ÑÓã¬ÏÖÏëͨ¹ýÓòÃûתÏòĿ¼ÐÎʽ½øÐйÜÀí£¨¼´½«ÓòÃûA¼Ç¼£Û°üÀ¨¶¥¼¶ÓòÃû¼°¶þ¼¶ÓòÃû£Ý¶¼Ö¸Ïòͬһ¿Õ¼ä£©
È磺·ÃÎÊÓòÃû abcd.cn Ö±½Ó·ÃÎÊÍøÕ¾¸ùĿ¼
·ÃÎʶþ¼¶ÓòÃû ef.abcd.cn ......
ÇëÎʸ÷룬php±à³ÌÓÃʲô¿ª·¢¹¤¾ß±È½ÏºÃ°¡£¿°³ÕýÔÚѧ¡£
ÊÇÔÚwindowsϵġ£
×îºÃµÄÊÇzend studio
phpºÃѧÂð£¿
Ì«ºÃѧ£¬ÈçÓÐCµÄ»ù´¡¸üºÃ
PHPÈëÃÅ»¹ÊÇÂù¼òµ¥µÄ£¬PHP¿ª·¢¹¤¾ßEditplus£¬zend studio¶¼¿ÉÒÔ£¬ ......