Php json decode return null
来源:互联网 发布:淘宝上的玛卡是真的吗 编辑:程序博客网 时间:2024/05/21 18:44
php json_decode will return a null answer when it
get ‘\uxxxx’ character since it only supports UTF-8 which was
declared by official website.
So how could we solve this question when we
want to json_decode(Chinese)?
Here provide two way to solve this:
$pp = '{"\u8499\u9a6c\u7279\u9057\u4e66\uff08\u8bd5\u8bfb\uff09": "https://read.douban.com/ebook/256340/", "\u6587\u5b66\u56de\u5fc6\u5f55\uff08\u8bd5\u8bfb\uff09": "https://read.douban.com/ebook/451767/", "\u6587\u5b66\u56de\u5fc6\u5f55\uff1a\u4e2d\u4e16\u7eaa\u2014\u5341\u4e03\u4e16\u7eaa\u4e4b\u5377": "https://read.douban.com/ebook/9837704/", "\u6587\u5b66\u56de\u5fc6\u5f55\uff1a\u53e4\u4ee3\u4e4b\u5377": "https://read.douban.com/ebook/9837472/", "\u6587\u5b66\u56de\u5fc6\u5f55\uff1a\u5341\u516b\u2014\u5341\u4e5d\u4e16\u7eaa\u4e4b\u5377": "https://read.douban.com/ebook/9841737/"}'; echo var_dump(json_decode($pp));
As you can see, we change the
\"
to"
And this is the second way, I love it.
$pp = '{\"\u8499\u9a6c\u7279\u9057\u4e66\uff08\u8bd5\u8bfb\uff09\": \"https://read.douban.com/ebook/256340/\", \"\u6587\u5b66\u56de\u5fc6\u5f55\uff08\u8bd5\u8bfb\uff09\": \"https://read.douban.com/ebook/451767/\", \"\u6587\u5b66\u56de\u5fc6\u5f55\uff1a\u4e2d\u4e16\u7eaa\u2014\u5341\u4e03\u4e16\u7eaa\u4e4b\u5377\": \"https://read.douban.com/ebook/9837704/\", \"\u6587\u5b66\u56de\u5fc6\u5f55\uff1a\u53e4\u4ee3\u4e4b\u5377\": \"https://read.douban.com/ebook/9837472/\", \"\u6587\u5b66\u56de\u5fc6\u5f55\uff1a\u5341\u516b\u2014\u5341\u4e5d\u4e16\u7eaa\u4e4b\u5377\": \"https://read.douban.com/ebook/9841737/\"}';$python = '"'.$pp.'"';echo json_decode($python);
阅读全文
1 0
- Php json decode return null
- php 和 perl 的json encode decode
- PHP JSON decode 的替代方法
- php 解决json输出中文为null
- php使用json_decode解析json返回NULL
- php使用json_decode解析json返回NULL
- DECODE AND NULL
- request.getParameter return null
- Return a null reference
- getActiveWorkbenchWindow() return null 解决办法
- zipOpen2_64 unzOpen2_64 return NULL
- 关于return null问题
- AfxGetMainWnd() return NULL
- DialogFragment getDialog() return null
- ToolProvider.getSystemJavaCompiler() Return NULL!
- LoadLibrary return null
- getActiveWorkbenchWindow() return null 解决办法
- how to configure spring mvc 三 to not return “null” object in json response
- Android animation呼吸动画 心形动画
- 【Swift】 Collections初识
- jdbctemplate
- Linux的#和$区别
- 关于算法的学习(1)
- Php json decode return null
- 孪生素数
- Comparable和Comparator区别
- 解决storm整合kafka遇到的:java.lang.NoClassDefFoundError: com/google/common/base/Strings
- tomcat开启https访问
- Hbase简单的java接口
- Bootstrap入门
- ASP.NET 页生命周期
- numpy 数组和矩阵的乘法的理解