时间:2021-07-01 10:21:17 帮助过:25人阅读
$content = '{"a":"\u4e2d\u6587\u540d\u79f0","b":"\u6d4b\u8bd5\u7a0b\u5e8f\u3002"}';$json = json_decode($content, true);echo '';echo $json['a'].'
'; //中文名称echo $json['b']; // 测试程序。
New Document
作为 js 代码
o = {"a":"\u4e2d\u6587\u540d\u79f0","b":"\u6d4b\u8bd5\u7a0b\u5e8f\u3002"};alert(o.a)作为 js 字符串
s = '{"a":"\u4e2d\u6587\u540d\u79f0","b":"\u6d4b\u8bd5\u7a0b\u5e8f\u3002"}';o = eval(s);alert(o.a)按 php 对象访问
$s = '{"a":"\u4e2d\u6587\u540d\u79f0","b":"\u6d4b\u8bd5\u7a0b\u5e8f\u3002"} ';$o = json_decode($s);echo $o->a;按 php 数组访问
$s = '{"a":"\u4e2d\u6587\u540d\u79f0","b":"\u6d4b\u8bd5\u7a0b\u5e8f\u3002"} ';$a = json_decode($s, true);echo $a['a'];