Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

php °²È«

ÈçºÎ²»Ê¹ÓÃprepared statment£¬¶øÊÇÓùýÂ˵ķ½·¨±ÜÃâSQL×¢ÈëÄØ£¿
Ò»°ãÀ´Ëµmysql×Ô´øµÄ¹ýÂ˺¯ÊýÊDZȽϿɿ¿µÄ¡£mysql_real_escape_string()
µ«ÊÇÕâ¸öº¯ÊýÔÚijЩ×Ö·û¼¯ÖÐÓÐÎÊÌ⣬±ÈÈçGBK¡£Èç¹ûÄãÓÃUTF8ÄÇû¹Øϵ¡£
ÔÚPHPÀïÉèÖÃÊý¾Ý¿âµÄ×Ö·û¼¯²»Ó¦¸ÃÓãºmysql_query("SET NAMES UTF8");
¶øÓ¦¸ÃÓãºmysql_set_charset()
ÕâÑùmysql_real_escape_string()ÔÚ´¦ÀíGBK±àÂëµÄʱºò¾Í²»»á³öÎÊÌâÁË¡£
mysql_real_escape_string() not safe when SET NAMES is used
use mysql_set_charset() instead.
Note: This is the preferred way to change the charset. Using mysql_query() to execute SET NAMES .. is not recommended.
SET NAMES is usually used to switch the encoding from what is default to what the application needs. This is done in a way that mysql_real_escape_string doesn’t know about this. This means if you switch to some multi byte encoding that allows backslash as 2nd 3rd 4th… byte you run into trouble, because mysql_real_escape_string doesn’t escape correctly. UTF-8 is safe…
Safe way to change encoding is mysql_set_charset, but that is only available in new PHP versions


Ïà¹ØÎĵµ£º

linuxϲ鿴nginx£¬apache£¬mysql£¬phpµÄ±àÒë²ÎÊý

ÒýÓÃhttp://www.linuxtone.org/html/76/t-2776.html
ÓÐʱºònginx£¬apache£¬mysql£¬php±àÒëÍêÁËÏë¿´¿´±àÒë²ÎÊý¿ÉÒÔÓÃÒÔÏ·½·¨
nginx±àÒë²ÎÊý£º
#/usr/local/nginx/sbin/nginx -V
CODE:
nginx version: nginx/0.6.32
built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42)
configure arguments: --user=www --group=www --p ......

ÓÃPhpÔõô±àд³ö¾ßÓи߰²È«µÄ´úÂë

PHPÊÇÒ»ÃÅ¿ª·¢Ëٶȿ죬ÔËÐÐËٶȿìµÄÓïÑÔ£¬µ«ÊÇËüÒ²ÓÐÖÂÃüȱµã£¬ÎÞ¶àỊ̈߳¨ËäÈ»ApacheµÄ·þÎñÆ÷ÔÚÁíÒ»Ö̶ֳÈÉÏÃÖ²¹ÁËÕâÖÖȱÏÝ£¬µ«ÊÇÔÚ±àдһЩÐèÒª¸ß²¢·¢²¢ÇÒ¿¼ÂÇЧÂʵijÌÐòÏ£¬Ëü»¹ÊÇÃ÷ÏÔ²»×㣩¡£
µ«ÊÇPHP¿ÉÒÔ´ó´óËõ¶Ì¿ª·¢ÖÜÆÚ£¬Ó뿪·¢³É±¾£¨±ÈÈçPHP¶ÔÓÚ³ÌÐòÒªÇóµÄÃż÷ºÜµÍ£©¡£
×ÜÌåÀ´Ëµ£¬PHPºÜÊʺϿª·¢ÍøÕ¾À´Ó㬶øÔÚ¿ª·¢ ......

PHP smartyѧϰ

phpÎļþ
<?php
mysql_connect("localhost","","");
mysql_query("set names 'gb2312'");
mysql_select_db("shop");
$sqlstr="select * from goods";
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;//ÉèÖø÷¸öĿ¼µÄ·¾¶£¬ÕâÀïÊÇ°²×°µÄÖصã
$smarty->template_dir ="smarty/templates/templa ......

PHP ¿ª·¢ÖÐÊý¾Ý¿â¼°ÆäÏà¹ØÈí¼þµÄÑ¡ÐÍ¿¼ÂÇ

    PHP °æ±¾¸÷Ò죬ÒѾ­Í£Ö¹Éý¼¶¿ª·¢µÄÓÐ 4.0 ϵÁÐµÄ 4.4.x£¬µ«ÏÖÔÚ»¹Óв¿·ÖÉú²ú»·¾³ÔÚÅÜÕâ¸ö°æ±¾£¬ÐèÒª¼ÌÐøά»¤´úÂë¡£PHP 5.0 ϵÁÐÊÇÏÖÔÚ¿ª·¢ºÍÓ¦ÓõÄÖ÷Á÷°æ±¾£¬ÓÐ 5.1.x ºÍ 5.2.x ϵÁС£PHP 6.0 Ä¿Ç°»¹ÊÇÊÔÓð汾£¬Óà PHP ¿ª·¢Èí¼þ²úÆ·µÄÈËÏÖÔÚ¿ÉÒÔÔ¤ÏÈ×÷¼æÈÝÐÔ²âÊÔ¡£
    PHP Ö§³ÖµÄÊý¾Ý ......

Àí½âPHPÖеÄMVC±à³ÌÖ®MVC¿ò¼Ü¼ò½é

¡¾Ê²Ã´ÊÇMVC£¿¡¿
        MVCÊÇÒ»¸ö¿ÉÒÔÈÃÄã°Ñ“Èý¸ö²¿·Ö£¨¼´MVCµÄÈ«³Æ£¬Model¡¢ View¡¢Controller£©”гµ÷µØ×é³ÉÒ»¸ö¸´ÔÓÓ¦ÓóÌÐòµÄ¸ÅÄî¡£Ò»Á¾Æû³µ¾ÍÊÇÒ»¸öÔÚÏÖʵÉú»îÖзdz£ºÃµÄMVCÀý×Ó¡£ÎÒÃÇ¿´³µ¶¼¿´Á½¸öView£¨ÏÔ Ê¾£©²¿·Ö£ºÄÚ²¿ºÍÍⲿ¡£¶øÕâÁ½¸ö¶¼Àë²»¿ªÒ»¸öController£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ