Home >Backend Development >PHP Tutorial >php截取字符串有关问题

php截取字符串有关问题

WBOY
WBOYOriginal
2016-06-13 12:26:081057browse

php截取字符串问题
"UID": 0, "RID": 0, "Name": "张三", "Sex": "女", "Age": 30,"mobile": "10000", "Job": "公司职员","remark": "很好",
 "ImgList": "a.jpg,b.jpg",   "Time": 1000000    怎么实现把他变成数组 的形式 以:前面为键名后面为键值 调用时可以直接
------解决思路----------------------

<br />$str = '"UID": 0, "RID": 0, "Name": "张三", "Sex": "女", "Age": 30,"mobile": "10000", "Job": "公司职员","remark": "很好",<br /> "ImgList": "a.jpg,b.jpg",   "Time": 1000000';<br /><br />$str = '{'.$str.'}';<br />$data = json_decode($str, true);<br /><br />echo $data['Name'].'<br>';<br /><br />print_r($data);<br />

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