PHPÖÐÎĽØÈ¡£¬UTF8ºÍGBKÏê½â
ÖÐÎÄ×Ö·û½ØÈ¡ÊÇÒ»¸öÊ®·ÖÓÐÓõŦÄÜ£¬ÔںܶàµØ·½¶¼»áÓõ½£¬±ÈÈçÌáÈ¡¶¨³¤±êÌ⣬³éÈ¡±êÇ©µÈ
ÓÉÓÚ¸÷ÖÖ×Ö·û¼¯µÄ´æ´¢·½Ê½µÄ²»Ò»Ñù£¬´æÔÚË«×Ö½Ú£¨GBK£©¶à×Ö½Ú£¨Unicode£©µÄ´æ´¢·½Ê½£¬Õâ¾Íµ¼ÖÂÁËͳһ´¦ÀíµÄÀ§ÄÑ¡£
¹ú¼Ê±ê×¼UTF8×Ö·û±àÂëÖУ¬´æ´¢ÖÐÎÄ×Ö·ûÒª3¸ö×Ö½Ú£¬¼´°ÑphpÎļþ´æ´¢ÎªUTF8±àÂë¸ñʽ¿ÉÒԵõ½
strlen("ÖÐ")=3
¼ÙÈçÖ±½ÓÓÃphpµÄ×Ö·û´®º¯ÊýÈ¥´¦ÀíÀàËÆÕâ¸ö×Ö·û½«¿ÉÄܲúÉúÂÒÓѵÄÇé¿ö£¬Ö÷ÒªÊÇÓÉÓÚÔÚÒ»¸öÍêÕû×Ö·ûÖмäÇ¿ÖƽضϲúÉú°ë×Ö·ûµÄÇé¿ö¡£Òª±ÜÃâÕâÖÖÇé¿öµÄΨһ°ì·¨¾ÍÊǰѽضÏλÖÃÑÓ³¤µ½Õâ¸ö×Ö·û½áÊøµÄλÖýøÐнضÏ
ÔÚPHPÖУ¬ÌṩÁËmbstringÄ£¿é¹¦ÄÜ£¬mbstringÒÔ×Ö·û×÷Ϊ²Ù×÷µÄ»ù±¾µ¥Ôª£¬Èçmb_strlen("ÖÐ","utf-8")=1
¡£
´ó²¿·ÖµÄmbstring¶¼ÒªÇóÊäÈë±àÂ룬µ±È»¿ÉÒÔÔÚphp»·¾³ÖÐÉèÖÃĬÈϵıàÂë¡£²ÎÊýÉèÖÃΪmbstring.internal_encoding
= UTF-8£¬¡¡mbstring.http_input = UTF-8£¬¡¡mbstring.http_output =
UTF-8£¬¡¡mbstring.substitute_character =
UTF-8¡£ÓÉÓÚphpϵͳһ°ãÊÇ´æ´¢×Ö½ÚÀ´¼ÆË㳤¶ÈµÄ£¬ÎªÁËÏû³ýmbstringºÍstringÖ®¼äµÄ²îÒ죬ʹÓÃmbstringµÄʱºò¾ÍÒª¸ñÍâСÐÄ
ÁË¡£
¼ÙÈ粻ʹÓÃmbstringµÄ¹¦ÄÜ µÄ»°£¬¿ÉÒÔ×ÔÐбàдÖÐÎÄ×Ö·û´¦ÀíµÄº¯Êý¡£
phpÖÐÎĽØÈ¡º¯Êý£¬¾ÍøÉÏËÑË÷ѧϰ·¢ÏÖ£¬´ó²¿·ÖÍøÂçÖж¼ÊÇÒÔ´Ó¿ªÊ¼Î»ÖÃÒ»¸öÒ»¸öÍêÕû×Ö·ûÀ´ÊµÏֵġ£ÕâÓпÉÄܵ¼ÖÂЧÂÊÊ®·Öµ×¡£ÏÂÃæÎÒдÁ˸ö½ØÈ¡º¯Êý,ÊÇÕë¶ÔUTF8µÄ
<?php
$str = "dÖУÔÚfÔÚÄãÊÇdÎҵĹú¼ÒÀ§gÔÚÓкͣ¬ÈË¡£¹¤";
var_dump(strcut($str,0,9));
function strcut($str,$start,$len){
if($start < 0)
$start = strlen($str)+$start;
$retstart = $start+getOfFirstIndex($str,$start);
echo $retstart;
$retend = $start + $len -1 + getOfFirstIndex($str,$start + $len);
echo $retend;
return substr($str,$retstart,$retend-$retstart+1);
}
//ÅжÏ×Ö·û¿ªÊ¼µÄλÖÃ
function getOfFirstIndex($str,$start){
$char_aci = ord(substr($str,$start-1,1));
if(223<$char_aci && $char_aci<240)
return -1;
$char_aci = ord(substr($str,$start-2,1));
if(223<$char_aci && $char_aci<240)
return -2;
return 0;
}
?>
224£239ÊÇUTF8ÖÐÎÄ×Ö·û¸ß루µÚһ룬¹²Èý룩asciiÇø¼ä£¬»»Ëã³ÉÊ®Áù½øÖÆΪ0xE0 - 0xEF ¶þ½øÖÆΪ1100 0000 - 1100 FFFF¡£Í¨
Ïà¹ØÎĵµ£º
Ê×ÏÈÀ´¸ö email.class.php Àࣺ
<?php
class smtp
{
/* Public Variables */
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;
/* Private Variables */
var $sock;
/* Constractor */
function smtp($rel ......
Ëæ ×ÅÍøÕ¾·ÃÎÊÁ¿µÄ¼Ó´ó£¬Ã¿´Î´ÓÊý¾Ý¿â¶ÁÈ¡¶¼ÊÇÒÔЧÂÊ×÷Ϊ´ú¼ÛµÄ£¬ºÜ¶àÓÃACCESS×÷Êý¾Ý¿âµÄ¸ü»áÉîÓÐÌå»á£¬¾²Ì¬Ò³¼ÓÔÚËÑË÷ʱ£¬Ò²»á±»ÓÅÏÈ¿¼ÂÇ¡£»¥ÁªÍøÉÏÁ÷ ÐеÄ×ö·¨Êǽ«Êý¾ÝÔ´´úÂëдÈëÊý¾Ý¿âÔÙ´ÓÊý¾Ý¿â¶ÁÈ¡Éú³É¾²Ì¬Ã棬ÕâÑùÎÞÐμä¾Í¼Ó´óÁËÊý¾Ý¿â¡£½«ÏÖÓеÄASPÒ³Ö±½ÓÉú³É¾²Ì¬Ò³£¬½«»á½ÚÊ¡ºÜ¶à¡£
ÏÂÃæµÄÀý×ÓÊǽ«¡¢index.asp?i ......
»ù´¡Ìâ
¡¡¡¡1.±íµ¥ÖÐ getÓëpostÌá½»·½·¨µÄÇø±ð?
¡¡¡¡´ð£ºgetÓû§¶Ë½«Êý¾Ý¼Óµ½URLºó£¬¸ñʽΪ”?×Ö¶Î1=ÊäÈëÊý¾Ý1&×Ö¶Î2=ÊäÈëÊý¾Ý2&..."¡£
¡¡¡¡ÓÉÓÚgetÌá½»²ÎÊýºó»áÔÚµØÖ·À¸ÖÐÏÔʾ³öÀ´£¬ËùÒÔ»á²úÉúÑÏÖصݲȫÎÊÌâ¡£
¡¡¡¡get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬get´«ÊäµÄÊý¾ÝÁ¿Ð¡£¬ÕâÖ÷ÒªÊÇÒòΪÊÜurl³¤¶ÈÏÞÖÆ;¶øpost¿ÉÒÔ´«Ê ......
±¾º¯ÊýÒÔ pattern µÄ¹æÔòÀ´½âÎö±È¶Ô×Ö·û´® subject¡£±È¶Ô½á¹û·µ»ØµÄÖµ·ÅÔÚÊý×é²ÎÊý matches Ö®ÖУ¬matches[0] ÄÚÈݾÍÊÇÔ×Ö·û´® subject¡¢matches[1] ΪµÚÒ»¸öºÏºõ¹æÔòµÄ×Ö·û´®¡¢matches[2] ¾ÍÊǵڶþ¸öºÏºõ¹æÔòµÄ×Ö·û´®£¬ÓàÀàÍÆ¡£ÈôÊ¡ÂÔ²ÎÊý matches£¬ÔòÖ»Êǵ¥´¿µØ±È¶Ô£¬ÕÒµ½Ôò·µ»ØֵΪ tr ......
PS:ÎÒ½ñÌìÅäÖà ·þÎñÆ÷µÄʱºò³öÏÖµÄÎÊÌâ¾ÍÊÇÕâ¸ö£¬µ«ÊÇÕÕ×Å·½·¨¶¼×öÁË£¬Ñ¾µÄ¡£¡£»¹ÊÇûÓ㬼«¶ÈÓôÃÆËÀ¡£¡£°¥¡£¡£¡£ÎÒÒ²²»ÖªµÀʲôÔÒòÄØ¡£¡£¿ÉÄܵÄÔÒò¶¼ÕÒ¹ýÁË¡£¡£ÓôÃÆ°¡`~
apache2+mysql+php5+phpmyadminÅäÖÃÎÊÌ⣺ÎÞ·¨¼ÓÈëmysqlÀ©Õ¹£¬Çë¼ì²éphpÅäÖÃ...
°²×°Íêapache2+mysql+php5ºó£¬°²×°phpmyadmin²¢ÅäÖúÃÒÔºó£¬ÔÚä¯À ......