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ÔÚÖ´ÐвéÕÒʱ²»Çø·Ö×ÖĸµÄ´óСд¡£µ±ÄãÔ
Ïà¹ØÎÊ´ð£º
ÎÒÔÚÍøÕ¾µÄÒýµ¼Ò³ÖÐÌí¼ÓÁË<embed src="ÒôÀÖµØÖ·" autostart="true" loop="true" hidden="true"></embed>
Õâ¾ä»°£¬È»ºóÌø×ªÒ³Ãæºó£¬±³¾°ÒôÀÖ¾ÍûÓÐÁË£¬ÔõôÈÃÕ ......
mssql_select_db("f1",mssql_connect("localhost","sa","sa"));
mssql_select_db("f2",mssql_connect("192.168.0.1","sa","sa") ......
ÏÖÓÐÒ»PHP¿Õ¼ä£¬Ö§³ÖMYSQLÊý¾Ý¿â
Ϊ½ÚÊ¡·ÑÓã¬ÏÖÏëͨ¹ýÓòÃûתÏòĿ¼ÐÎʽ½øÐйÜÀí£¨¼´½«ÓòÃûA¼Ç¼£Û°üÀ¨¶¥¼¶ÓòÃû¼°¶þ¼¶ÓòÃû£Ý¶¼Ö¸Ïòͬһ¿Õ¼ä£©
È磺·ÃÎÊÓòÃû abcd.cn Ö±½Ó·ÃÎÊÍøÕ¾¸ùĿ¼
·ÃÎʶþ¼¶ÓòÃû ef.abcd.cn ......
¼±Çó£ºÔÚphp½Å±¾ÀïÔõôµ÷ÓÃjsÎļþÀï·½·¨£¿
»òÕßÔÚjsÎļþÀïµ÷ÓÃphpÎļþдµÄseesion£¿
PHP¸ÕÈëÃÅѧϰ,ÓÑÇé¶¥Ò»¸ö
¼±Çó£ºÔÚphp½Å±¾ÀïÔõôµ÷ÓÃjsÎļþÀï·½·¨£¿
//echo '<script>alert("ok");< ......
ÔÚÐÞ¸ÄÍêphp.ini£¬ºÍhpptd.confºó´ò¿ªhttp://localhostÄܹ»ÏÔʾIt Works!ͨ¹ýapacheÖ§³Öphp5²âÑé,²»¹ý²»ÖªµÀΪʲôºóÀ´´ò¿ªhttp://localhostºÍhttp://localhost/index.phpЧ¹û¶¼ÊÇPHPÐÅÏ¢¡£
´ò¿ªhttp://localhost/i ......