我的测试代码示例:
<?
$city = "L\u00e9ry, Quebec";
echo 'city original: '.$city.'<br>';
$city = preg_replace('/u([\da-fA-F]{4})/', '&#x\1;', $city);
echo 'city modified: '.$city.'<br>';
?>
我的结果是:
city original: L\u00e9ry, Quebec
city modified: L\éry, Q
我有一些问题... thx
答案 0 :(得分:-3)
这应该适合你:
$city = preg_replace('/\\\\u([0-9a-fA-F]{4})/', '&#x\1;', $city);
输出:
city original: L\u00e9ry, Quebec
city modified: Léry, Quebec