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

php ºº×Öת»¯³É ¶þ½øÖÆ Ê®½øÖÆ Ê®Áù½øÖÆ Êý×Ö

<?php
/**
* °ÑÒ»¸öºº×ÖתΪunicodeµÄͨÓú¯Êý£¬²»ÒÀÀµÈκο⣬ºÍ±ðµÄ×Ô¶¨Ò庯Êý£¬µ«ÓÐÌõ¼þ
* Ìõ¼þ£º±¾ÎļþÒÔ¼°º¯ÊýµÄÊäÈë²ÎÊýÓ¦¸ÃÓÃutf-8±àÂ룬²»È»Òª¼Óº¯Êýת»»
* ÆäʵÒà¿ÉÇáÒ×±àд·´Ïòת»»µÄº¯Êý£¬ÉõÖÁ²»¾ÖÏÞÓÚºº×Ö£¬Ææ¹ÖΪʲôPHPûÓÐÏֳɺ¯Êý
* @author xieye
*
* @param {string} $word ±ØÐëÊÇÒ»¸öºº×Ö£¬»ò´ú±íºº×ÖµÄÒ»¸öÊý×é(ÓÃstr_splitÇиî¹ý)
* @return {string} Ò»¸öÊ®½øÖÆunicodeÂ룬Èç4f60£¬´ú±íºº×Ö “Äã”
*
* @example
echo "Äã ".getUnicodefromOneUTF8("Äã");
echo "<br />";
echo "ºÃ ".getUnicodefromOneUTF8("ºÃ");
echo "<br />";
echo "ÄãºÃ ".getUnicodefromOneUTF8("ÄãºÃ");
echo "<br />";
echo "ÄãºÃÂð ".getUnicodefromOneUTF8("ÄãºÃÂð");
Äã 20320
ºÃ 22909
ÄãºÃ 251503099357000
ÄãºÃÂð 4.21952182258E+21
*/
function getUnicodefromOneUTF8($word) {
//»ñÈ¡Æä×Ö·ûµÄÄÚ²¿Êý×é±íʾ£¬ËùÒÔ±¾ÎļþÓ¦ÓÃutf-8±àÂë!
if (is_array( $word))
$arr = $word;
else
$arr = str_split($word);
//´Ëʱ£¬$arrÓ¦ÀàËÆarray(228, 189, 160)
//¶¨ÒåÒ»¸ö¿Õ×Ö·û´®´æ´¢
$bin_str = '';
//ת³ÉÊý×ÖÔÙת³É¶þ½øÖÆ×Ö·û´®£¬×îºóÁªºÏÆðÀ´¡£
foreach ($arr as $value)
$bin_str .= decbin(ord($value));
//´Ëʱ£¬$bin_strÓ¦ÀàËÆ111001001011110110100000,Èç¹ûÊǺº×Ö"Äã"
//ÕýÔò½ØÈ¡
$bin_str = preg_replace('/^.{4}(.{4}).{2}(.{6}).{2}(.{6})$/','$1$2$3', $bin_str);

//´Ëʱ£¬ $bin_strÓ¦ÀàËÆ0100111101100000,Èç¹ûÊǺº×Ö"Äã"
return bindec($bin_str);
//·µ»ØÀàËÆ20320£¬ ºº×Ö"Äã"
//return dechex(bindec($bin_str));
//ÈçÏë·µ»ØÊ®Áù½øÖÆ4f60£¬ÓÃÕâ¾ä
}
echo "Äã ".getUnicodefromOneUTF8("Äã");
echo "<br />";
echo "ºÃ ".getUnicodefromOneUTF8("ºÃ");
echo "<br />";
echo "ÄãºÃ ".getUnicodefromOneUTF8("ÄãºÃ");
echo "<br />";
echo "ÄãºÃÂð ".getUnicodefromOneUTF8("ÄãºÃÂð");
exit;
?> 


Ïà¹ØÎĵµ£º

PHP¾­Ñé·ÖÏí

1.Èç¹ûÒ»¸ö·½·¨Äܱ»¾²Ì¬£¬ÄǾÍÉùÃ÷ËûΪ¾²Ì¬µÄ£¬ËٶȿÉÌá¸ß1/4;
¡¡¡¡2.echoµÄЧÂʸßÓÚprint,ÒòΪechoûÓзµ»ØÖµ£¬print·µ»ØÒ»¸öÕûÐÍ;
¡¡¡¡3.ÔÚÑ­»·Ö®Ç°ÉèÖÃÑ­»·µÄ×î´ó´ÎÊý£¬¶ø·ÇÔÚÔÚÑ­»·ÖÐ;
¡¡¡¡4.Ïú»Ù±äÁ¿È¥ÊÍ·ÅÄڴ棬ÌرðÊÇ´óµÄÊý×é;
¡¡¡¡5.±ÜÃâʹÓÃÏñ__get, __set, __autoloadµÈħÊõ·½·¨;
¡¡¡¡6.requiere_once()±È½Ï ......

PHP»º³å¼¼Êõ


Ò»¡¢»º´æ¼¼Êõ:   
ÓÐЩÐÅÏ¢±È·½¾­³£²»±äµÄ,µ«ÊÇ»¹ÊÇÄܱäµÄÐÅÏ¢·ÅÔÚ»º´æÖÐÒÔ¼Ó¿ìÏÔʾËÙ¶È,ÕâÊǺÜÓмÛÖµµÄ,ËùνµÄ»º´æ,ͨË×µÄÀí½â¾ÍÊÇһЩ±£´æÔÚ·þÎñÆ÷¶ËµÄ¹²ÓÃÐÅÏ¢.ËüÊÇÓÚ·þÎñÆ÷ͬÉúËÀµÄ,ÎÒÃÇÔÚ±£´æ»º´æµÄʱºò¿ÉÒÔÖ¸¶¨Ï´θüеÄʱ¼äµÄÅжÏ,±È·½ÒªÔÚ5·ÖÖÓ¸üÐÂÒ»´Î,¿ÉÒԼǼÉϴθüеÄʱ¼ä,ºÍµ±Ç°Ê±¼ä±È½Ï, ......

phpºóÍËÒ»Ò³±íµ¥ÄÚÈݵı£´æ


php±íµ¥ÔÚÌá½»Ö®ºóÔÙºóÍË,±íµ¥µÄÄÚÈÝĬÈÏÊDZ»Çå¿ÕµÄ(ʹÓÃsession_startµÄʱºò),
½â¾ö·½·¨ÊÇÔÚsession_start()Ö®ºó,×Ö·ûÊä³ö֮ǰдÉÏ
header(“Cache-control: private”);  
 
ÍøÒ³µÄ»º´æÊÇÓÉHTTPÏûϢͷÖеēCache-control”À´¿ØÖƵģ¬³£¼ûµÄÈ¡ÖµÓÐprivate¡¢no- cache¡¢max-age¡ ......

¼òµ¥µÄ¸ÅÊö¶ÔphpµÄÈÏʶ

×÷Ϊһ¸öphp³ÌÐòÔ±À´Ëµ¡£¡£ÓÐʲôÊÇÎÒÃÇÓ¦¸ÃÖªµÀµÄÄØ£¿
Ê×ÏÈÀ´ËµÒ»Ï¡£phpÖ®ËùÒÔÄܹ»ÔÚ¹úÄÚ×ߺ졣¡£Æä×îÖØÒªµÄÒ»µã¾ÍÊÇËûÊÇ¿ªÔ´µÄ¡£ºÃ¶àÓÅÐãµÄ¶«Î÷¶¼¿ÉÒÔÃâ·ÑµÄÄÃÀ´Óá£ÏÖÔÚÊÐÃæÉÏÓÐÄÇô¶¼µÄphp¿ªÔ´²úÆ·¡£µ±ÎÒÃÇÐèÒª×öÒ»¸öÏà¹ØµÄÍøÕ¾µÄʱºò¡£Ö»Òª°ÑÈ˼ҵIJúÆ·ÄùýÀ´¡£¸ù¾Ý×Ô¼ºµÄÐèÒª×ö¶þ´Î¿ª·¢¾Í¿ÉÒÔÁË¡£¡£´Ó¶øʹphpÏîÄ¿µÄ ......

PHPÖг£ÓõÄ×Ö·û´®º¯Êý

¡¡PHPÖеÄ×Ö·û´®²Ù×÷¹¦ÄÜÊDZȽ϶àµÄ,ÖØÒªµÄÓÐÒÔÏÂÕâЩ:
¡¡¡¡(1)echo,print,printf,sprintf
¡¡¡¡Ç°Á½¸öº¯ÊýÊÇÊä³ö×Ö·û´®.×Ö·û´®ÖÐÈç¹ûÓбäÁ¿ÃûÔò±»Ìæ»»³ÉÆäÖµ. ºóÁ½¸öº¯ÊýÀàËÆÓÚCµÄͬÃûº¯Êý.
¡¡¡¡(2)strchr,strlen,strtok,strrchr,strrev,strstr,strtolower, strtoupper,substr,ucfirst
¡¡¡¡ÕâЩÊdz£ÓõÄ×Ö·û´®²Ù×÷º¯Êý, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ