將中文字轉換成 &#xxxxx; UNICODE 碼, 主要的用途在於, 不用擔心有顯示不出來的文字.
引用來源
05 |
$unicode_html = base_convert (bin2hex(iconv( 'UTF-8' , 'UCS-4' , $str )), 16, 10); |
07 |
$unicode_html = base_convert (bin2hex(mb_convert_encoding( $str , 'ucs-4' , 'utf-8' )), 16, 10); |
09 |
$unicode_html = '&#' . base_convert (bin2hex(iconv( "utf-8" , "ucs-4" , $str )), 16, 10) . ';' ; |
11 |
$str = mb_convert_encoding( $unicode_html , 'UTF-8' , 'HTML-ENTITIES' ); |
http://calos-tw.blogspot.com/2011/06/php-unicode.html
|