/*将16进制编码转换为汉字*/
function hexDecode($s) {
return preg_replace('/(w{2})/e',"chr(hexdec('\1'))",$s);
}
/*汉字转换成16进制后的编码*/
$str="7B22636F6E74726F6C223A22343AE5AE8BE4
BD932C422C302C30222C22657874656E6469
6E666F223A22323031343033323731383
53335397C307C7EE4B88DE8A681E68993E985B1
E6B2B97E222C22657874656E6474
797065223A22222C2274
797065223A226E6F726D616C6D7367
222C226D7367223A2261
646720227D"; www.111cn.net
$a=hexDecode($str);//调用反转换函数转换16进制
echo $a;//输出{"control":"4:宋体,B,0,0","extendinfo":"20140327185359|0|~不要打酱油~","extendtype":"","type":"normalmsg","msg":"adg "}
$a = json_decode($a);
echo($a->msg);//取出msg字段信息
?>
|