Home  >  Article  >  Backend Development  >  u6784门类汉字转换

u6784门类汉字转换

WBOY
WBOYOriginal
2016-06-13 11:15:281120browse

\u6784类型汉字转换
\u6784这样的字符串,如何通过php和js进行汉字转移(转成能人能看懂的汉字),比如$string='\u6784'


------解决方案--------------------
echo json_decode('"\u6784"');//构

------解决方案--------------------
引用:
echo json_decode('"\u6784"');//构


你确定这样可行?我测试的返回的是null
我的作法是拼成json串,然后decode

$string = '\u6784';
$json_str = '{"str":"'.$string.'"}';
var_dump(json_decode($json_str, 1)); 


------解决方案--------------------
不要怀疑人家的诚意
你的代码的运行结果:
'str' => string '构' (length=3)

------解决方案--------------------
用json_decode解Unicode    高
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn