Home  >  Article  >  Backend Development  >  数据库获取josn字符串怎么解析

数据库获取josn字符串怎么解析

WBOY
WBOYOriginal
2016-06-13 12:54:08844browse

数据库获取josn字符串如何解析
从数据库中获取的json字符串赋给一个变量,再用json_decode()解析变量得到null,如果直接用字符串就可以解析成json对象,请问是为何?

这是输出的字符串
[
    {
        "school": "u5317u4eacu5927u5b66",
        "start": "09-2004",
        "end": "06-2008",
        "qualifications": "u5b66u58eb",
        "qualifications_date": "01-06-2008"
    },
    {
        "school": "",
        "start": "",
        "end": "",
        "qualifications": "",
        "qualifications_date": ""
    }
]


------解决方案--------------------
json_decode($json, true));
当该参数为 TRUE 时,将返回 array 而非 object 。  
------解决方案--------------------
贴你的代码出来看看
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