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
Ïà¹ØÎĵµ£º
Blogϵͳ×÷Ϊ´ó¼Ò×î³£½Ó´¥µÄ»¥ÁªÍø¶«¶«£¬ÔÚÕ¾³¤ÈºÌåÖм¸ºõÈËÊÖÒ»²©£¬´ÓÖªÃûÃÅ»§µÄ²©¿ÍƵµÀ£¬µ½ÍøÂçÓªÏúר¼Ò²©¿Í£¬ÍøÃñ¶Ô²©¿ÍµÄ¹Ø×¢¶ÈÔÚ²»¶ÏÌá¸ß²¢É¡£Ä¿Ç°ÍøÉÏÃâ·ÑµÄblogϵͳ̫ÔÓ£¬ÔÚ´ËÕûÀíPHP°æµÄBlog½éÉÜÈçÏ£º
1¡¢wordpress:http://www.wordpress.org ¹¦ÄÜÒ²ºÜÈ«Ã棬Ӧ¸ÃÊÇÖ§³ÖblogµÄÊ×Ñ¡¡£ËüÓÐ×îÇ¿µÄÄ£°æ¹¦ÄÜ£¬ÒѾ ......
½øÐÐÎļþµÄ¶ÁºÍд£¬ÏÈ´ò¿ªÒ»¸öÎļþ£¬È»ºó¿ªÊ¼¶Á»òÕßдÎļþ£¬×îºóÔÙ¹ØϵÕâ¸öÎļþ×ÊÔ´¡£
È磬ÎļþµÄ¶Á²Ù×÷£º
<?php
$file = fopen('your file path','r');
while(!feof($file)){ //µ±Ã»ÓжÁÈ¡µ½Îļþ½á⣬¼ÌÐøÑ»·¶ÁÈ¡²Ù×÷
$line = fgets($file); //¶ÁÈ¡µ½Ò»ÐеÄÄÚÈÝ
echo $line.'<br/>';
}
fclose($file) ......
<?php
function remove_directory($dir) {
if ($handle = opendir("$dir")) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
......
php°²×°³ÌÐòÔÀí£º
ÆäʵPHP³ÌÐòµÄ°²×°ÔÀíÎ޷ǾÍÊǽ«Êý¾Ý¿â½á¹¹ºÍÄÚÈݵ¼Èëµ½ÏàÓ¦µÄÊý¾Ý¿âÖУ¬´ÓÕâ¸ö¹ý³ÌÖÐÖØÐÂÅäÖÃÁ¬½ÓÊý¾Ý¿âµÄ²ÎÊýºÍÎļþ£¬ÎªÁ˱£Ö¤²»±»±ðÈ˶ñÒâʹÓð²×°Îļþ£¬µ±°²×°Íê³ÉºóÐèÒªÐ޸ݲװÎļþ¡£
²½Ö裺
¼ì²éĿ¼»òÎļþµÄȨÏÞ
Ð޸ĻòÌî¼ÓÅäÖÃÎļþ
¼ì²éÅäÖÃÎļþÕýÈ·ÐÔ
µ¼ÈëÊý¾Ý¿â
Ëø¶¨»òÉ ......
ÎÊÌ⣺
ÄãÏë´´½¨Ò»¸ö¶ÔÏ󣬲¢ÔÚÆäÖÐÌí¼ÓһЩÊôÐÔ£¬µ«ÊÇÄãÈ´²»Ïë°ÑËü×÷Ϊһ¸öÃ÷È·µÄÀàÕýʽµØ¶¨ÒåËü¡£ÕâÒ»µãÔÚһЩÇé¿öÏÂÊÇÏ൱ÓÐÓõģ¬ÀýÈçµ±ÄãÐèÒª¶¨ÒåÒ»¸ö·½·¨À´·µ»Ø´øÓÐijЩÊôÐÔ£¨²»È·¶¨µÄ£©µÄ¶ÔÏóʱ£¬¾ÍÈçͬ´Ómysql_fetch_object( ) »òÕß imap_header( )µÄʹÓÃÒ»Ñù¡£
һάÊý×é,ÎÒÏÖÔÚÌرðϲ»¶°ÑËüд³É¶ÔÏó,ÒòΪ¼üÅÌ´ ......