Home > Article > Backend Development > 接口传过去的值,别人解析
??{ "status":"ok", "msg":"登录成功!", "data":[ { "uid":"27", "username":"123", "password":"202cb962ac59075b964b07152d234b70", "nickname":"aaa", "telephone":"", "phone":null, "qq":"", "fax":null, "email":"", "department":"", "job":null, "seniority":"0", "integral":"10", "strength":null, "ip":null, "time":null } ]}
1、有多个 BOM 头
2、null 也要用双引号括起来
print_r(json_decode($s));
解码后
stdClass Object( [status] => ok [msg] => 登录成功! [data] => Array ( [0] => stdClass Object ( [uid] => 27 [username] => 123 [password] => 202cb962ac59075b964b07152d234b70 [nickname] => aaa [telephone] => [phone] => null [qq] => [fax] => null [email] => [department] => [job] => null [seniority] => 0 [integral] => 10 [strength] => null [ip] => null [time] => null ) ))
1、有多个 BOM 头
2、null 也要用双引号括起来
print_r(json_decode($s));
解码后
stdClass Object( [status] => ok [msg] => 登录成功! [data] => Array ( [0] => stdClass Object ( [uid] => 27 [username] => 123 [password] => 202cb962ac59075b964b07152d234b70 [nickname] => aaa [telephone] => [phone] => null [qq] => [fax] => null [email] => [department] => [job] => null [seniority] => 0 [integral] => 10 [strength] => null [ip] => null [time] => null ) ))
推荐一个网站给你检测一下你的json数据格式吧, http://bejson.com
bejson正解
1、有多个 BOM 头
2、null 也要用双引号括起来
print_r(json_decode($s));
解码后
stdClass Object( [status] => ok [msg] => 登录成功! [data] => Array ( [0] => stdClass Object ( [uid] => 27 [username] => 123 [password] => 202cb962ac59075b964b07152d234b70 [nickname] => aaa [telephone] => [phone] => null [qq] => [fax] => null [email] => [department] => [job] => null [seniority] => 0 [integral] => 10 [strength] => null [ip] => null [time] => null ) ))