PHP内でUnicode PCREシーケンス( \x{2f}
, など\x{3251}
)を文字列に変換することは可能ですか?
1 に答える
4
html_entity_decodeを使用すると、その可能性があります
function cb($a){
$num = $a[1];
$dec = hexdec($num);
return "&#$dec;";
}
$ent = preg_replace_callback("/\\\\x\{([\da-z]+)\}/i", 'cb', "\x{2f}, \x{3251}");
$ustr = html_entity_decode($ent, ENT_NOQUOTES, 'UTF-8');
サンプル: http: //ideone.com/fDNGM
于 2012-04-20T18:30:07.420 に答える