php转换\\u(UNICODE)字符串为汉字

<?php
test = ‘\u53c2\u8d5b\u56e2\u961f\u65b9\u6848\u540d\u79f0’; //庆重庆temp = explode(‘\u’,test); //拆分成数组rslt = array(); //保存结果的数组
array_shift(temp); //去掉第一个不含数据的
foreach(
temp as k =>v) {
v = hexdec(v); //将16进制转换成十进制
rslt[] = ‘&#’ .v . ‘;’; //转换成html实体
}
rslt = implode(”,rslt); //组合结果数组成字符串

echo $rslt;
?>

prolove 的头像

发表回复

  • b853

  • 9388

  • bc41

  • 0128

  • e36e

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Insert the contact form shortcode with the additional CSS class- "bloghoot-newsletter-section"

By signing up, you agree to the our terms and our Privacy Policy agreement.