某个数组用JSON的格式存在数据库,使用json_encode转义。例如
[{"k":"u673au6cb9u8fc7u6ee4","v":"u4e07u516cu91ccu4e00u66f4u6362sss"},{"k":"u7a7au6c14u6ee4u82af","v":"u4e07u516cu91ccu4e00u66f4u6362"},{"k":"u71c3u6cb9u6ee4u82af","v":"u4e07u516cu91ccu4e00u66f4u6362"},{"k":"u7a7au8c03u6ee4u82af","v":"u4e07u516cu91ccu4e00u66f4u6362"},{"k":"u53d8u901fu7bb1u6cb9","v":"u4e07u516cu91ccu4e00u66f4u6362"},{"k":"u706bu82b1u585e","v":"u4e07u516cu91ccu4e00u66f4u6362"},{"k":"u5236u52a8u6db2","v":"u5e74u4e00u66f4u6362"},{"k":"u8f6cu5411u52a9u529bu6cb9","v":""},{"k":"u51b7u5374u6db2","v":""},{"k":"u6b63u65f6u94feu6761","v":""},{"k":"u76aeu5e26","v":""},{"k":"u673au6cb9u53c2u6570","v":""},{"k":"u5236u52a8u5668","v":"u89c6u68c0u67e5u7ed3u679cu800cu5b9a"},{"k":"u5907u6ce8","v":""}]
问题是你的数据在 json_encode 后为
[{"k":"\u673a\u6cb9\u8fc7\u6ee4","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362sss"},{"k":"\u7a7a\u6c14\u6ee4\u82af","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u71c3\u6cb9\u6ee4\u82af","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u7a7a\u8c03\u6ee4\u82af","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u53d8\u901f\u7bb1\u6cb9","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u706b\u82b1\u585e","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u5236\u52a8\u6db2","v":"\u5e74\u4e00\u66f4\u6362"},{"k":"\u8f6c\u5411\u52a9\u529b\u6cb9","v":""},{"k":"\u51b7\u5374\u6db2","v":""},{"k":"\u6b63\u65f6\u94fe\u6761","v":""},{"k":"\u76ae\u5e26","v":""},{"k":"\u673a\u6cb9\u53c2\u6570","v":""},{"k":"\u5236\u52a8\u5668","v":"\u89c6\u68c0\u67e5\u7ed3\u679c\u800c\u5b9a"},{"k":"\u5907\u6ce8","v":""}]为什么你要贪污掉反斜杠 \ ?
<script>d = [{"k":"\u673a\u6cb9\u8fc7\u6ee4","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362sss"},{"k":"\u7a7a\u6c14\u6ee4\u82af","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u71c3\u6cb9\u6ee4\u82af","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u7a7a\u8c03\u6ee4\u82af","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u53d8\u901f\u7bb1\u6cb9","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u706b\u82b1\u585e","v":"\u4e07\u516c\u91cc\u4e00\u66f4\u6362"},{"k":"\u5236\u52a8\u6db2","v":"\u5e74\u4e00\u66f4\u6362"},{"k":"\u8f6c\u5411\u52a9\u529b\u6cb9","v":""},{"k":"\u51b7\u5374\u6db2","v":""},{"k":"\u6b63\u65f6\u94fe\u6761","v":""},{"k":"\u76ae\u5e26","v":""},{"k":"\u673a\u6cb9\u53c2\u6570","v":""},{"k":"\u5236\u52a8\u5668","v":"\u89c6\u68c0\u67e5\u7ed3\u679c\u800c\u5b9a"},{"k":"\u5907\u6ce8","v":""}];for(i=0; i<d.length; i++) document.write(d[i].k + ' => ' + d[i].v + '<br>');</script>
机油过滤 => 万公里一更换sss空气滤芯 => 万公里一更换燃油滤芯 => 万公里一更换空调滤芯 => 万公里一更换变速箱油 => 万公里一更换火花塞 => 万公里一更换制动液 => 年一更换转向助力油 => 冷却液 => 正时链条 => 皮带 => 机油参数 => 制动器 => 视检查结果而定备注 =>
u前面缺少斜杠了。
如果你数据库保存就是这种格式,可以这样读取。
New Document