utf-8 字符串轉爲Unicode編碼格式

function to_unicode($string) { spa

$str = mb_convert_encoding($string, 'UCS-2', 'UTF-8');code

$arrstr = str_split($str, 2); unicode

$unistr = ''; string

foreach ($arrstr as $n) {it

$dec = hexdec(bin2hex($n)); io

$unistr .= '&#' . $dec . ';'; function

}class

return $unistr;foreach

}coding

相關文章
相關標籤/搜索