这样解析json为什么没效果?
程序员文章站
2022-06-04 08:57:42
...
$json的内容大概是这样的:
{"pagination":{},"meta":{"code":200},"data":[{"attribution":null,"tags":[],"type":"image","location":null,"comments":{"count":0},"filter":"Normal","created_time":"1453516817","link":"https:\/\/www.instagram.com\/p\/BA3XjWMP4ye\/","likes":{"count":0},"images":{"low_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s320x320\/e35\/12547507_218933238449715_1618422633_n.jpg","width":320,"height":320},"thumbnail":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s150x150\/e35\/12547507_218933238449715_1618422633_n.jpg","width":150,"height":150},"standard_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12547507_218933238449715_1618422633_n.jpg","width":640,"height":640}},"users_in_photo":[],"caption":null,"user_has_liked":false,"id":"1168506212405185694_2231334066","user":{"username":"misery","profile_picture":"https:\/\/scontent.cdninstagram.com\/hphotos-xta1\/t51.2885-19\/10684024_538087799681202_2023427205_a.jpg","id":"2231334066","full_name":"misery"}},{"attribution":null,"tags":[],"type":"image","location":null,"comments":{"count":0},"filter":"Hefe","created_time":"1444533784","link":"https:\/\/www.instagram.com\/p\/8rpxxov48o\/","likes":{"count":2},"images":{"low_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s320x320\/e35\/11910259_421481191371212_1146964092_n.jpg","width":320,"height":320},"thumbnail":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s150x150\/e35\/11910259_421481191371212_1146964092_n.jpg","width":150,"height":150},"standard_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s640x640\/sh0.08\/e35\/11910259_421481191371212_1146964092_n.jpg","width":640,"height":640}},"users_in_photo":[],"caption":null,"user_has_liked":false,"id":"1093151075025784616_2231334066","user":{"username":"misery","profile_picture":"https:\/\/scontent.cdninstagram.com\/hphotos-xta1\/t51.2885-19\/10684024_538087799681202_2023427205_a.jpg","id":"2231334066","full_name":"misery"}}]}
回复内容:
$json的内容大概是这样的:
{"pagination":{},"meta":{"code":200},"data":[{"attribution":null,"tags":[],"type":"image","location":null,"comments":{"count":0},"filter":"Normal","created_time":"1453516817","link":"https:\/\/www.instagram.com\/p\/BA3XjWMP4ye\/","likes":{"count":0},"images":{"low_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s320x320\/e35\/12547507_218933238449715_1618422633_n.jpg","width":320,"height":320},"thumbnail":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s150x150\/e35\/12547507_218933238449715_1618422633_n.jpg","width":150,"height":150},"standard_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12547507_218933238449715_1618422633_n.jpg","width":640,"height":640}},"users_in_photo":[],"caption":null,"user_has_liked":false,"id":"1168506212405185694_2231334066","user":{"username":"misery","profile_picture":"https:\/\/scontent.cdninstagram.com\/hphotos-xta1\/t51.2885-19\/10684024_538087799681202_2023427205_a.jpg","id":"2231334066","full_name":"misery"}},{"attribution":null,"tags":[],"type":"image","location":null,"comments":{"count":0},"filter":"Hefe","created_time":"1444533784","link":"https:\/\/www.instagram.com\/p\/8rpxxov48o\/","likes":{"count":2},"images":{"low_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s320x320\/e35\/11910259_421481191371212_1146964092_n.jpg","width":320,"height":320},"thumbnail":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s150x150\/e35\/11910259_421481191371212_1146964092_n.jpg","width":150,"height":150},"standard_resolution":{"url":"https:\/\/scontent.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s640x640\/sh0.08\/e35\/11910259_421481191371212_1146964092_n.jpg","width":640,"height":640}},"users_in_photo":[],"caption":null,"user_has_liked":false,"id":"1093151075025784616_2231334066","user":{"username":"misery","profile_picture":"https:\/\/scontent.cdninstagram.com\/hphotos-xta1\/t51.2885-19\/10684024_538087799681202_2023427205_a.jpg","id":"2231334066","full_name":"misery"}}]}
转义而已,对自己问题的补充修改问题详情即可,不要发表在回答区域
data;
foreach($data as $row){
echo $row->images->standard_resolution->url."
";
}
你只用了json_decode来解码,但是输出的时候并没有json_encode啊。 输出的应该只是一堆字符串吧? \是用来转移字符的. \/ 其实输出以后就是/
推荐阅读
-
这样解析json为什么没效果?
-
为什么我做出来的效果是这样的呢?弄了快2个小时无果。。。。_html/css_WEB-ITnose
-
为什么json解析之后跟原来的不一样
-
这样解析json为什么没效果?
-
为什么我做出来的效果是这样的呢?弄了快2个小时无果。。。。_html/css_WEB-ITnose
-
php这样写为什么没效果
-
php这样写为什么没效果
-
json_encode()函数为什么不能解析带中文的JSON字符串呢?
-
为什么像这样的标签输入没有效果呢.。。。_html/css_WEB-ITnose">
为什么像这样的标签输入没有效果呢.。。。
_html/css_WEB-ITnose -
[已解决]php如何解析这样的json字符串