2016-09-17 93 views

回答

0

你可以尝试这样的事:

$text = preg_replace_callback('/\\\\x([0-9a-fA-F]{2})/', function ($matches) { return chr(hexdec($matches[1])); },$text); 

编辑:对不起,我只是复制/粘贴的旧代码 - 在e修正已过时。

+0

返回相同的文本:'$ text ='\ xea'; $ text = preg_replace('/(\\ x [0-9a-fA-F] {2})/ e',“chr(hexdec(substr('\\ 1',2,2)))”, $文本); echo $ text;' –

+0

对不起,我只是复制/粘贴旧代码 - 请尝试新的代码片段。 –

+0

现在完美。 :) 非常感谢。 –