使用file_get_contents从JSON到PHP数组

使用file_get_contents从JSON到PHP数组,第1张

使用file_get_contents从JSON到PHP数组

您提供的JSON示例无效。使用此JSON验证程序http://jsonlint.com/在线进行检查。您需要删除第59行上的多余逗号

一个拥有有效json的人,可以使用此代码将其转换为数组。

json_depre($ json,true);

Array(    [bpath] => http://www.sampledomain.com/    [clist] => Array        ( [0] => Array     (         [cid] => 11         [display_type] => grid         [ctitle] => abc         [acount] => 71         [alist] => Array  (      [0] => Array          (   [aid] => 6865   [adate] => 2 Hours ago   [atitle] => test   [adesc] => test desc   [aimg] =>    [aurl] => ?nid=6865   [weburl] => news.php?nid=6865   [cmtcount] => 0          )      [1] => Array          (   [aid] => 6857   [adate] => 20 Hours ago   [atitle] => test1   [adesc] => test desc1   [aimg] =>    [aurl] => ?nid=6857   [weburl] => news.php?nid=6857   [cmtcount] => 0          )  )     ) [1] => Array     (         [cid] => 1         [display_type] => grid         [ctitle] => test1         [acount] => 2354         [alist] => Array  (      [0] => Array          (   [aid] => 6851   [adate] => 1 Days ago   [atitle] => test123   [adesc] => test123 desc   [aimg] =>    [aurl] => ?nid=6851   [weburl] => news.php?nid=6851   [cmtcount] => 7          )      [1] => Array          (   [aid] => 6847   [adate] => 2 Days ago   [atitle] => test12345   [adesc] => test12345 desc   [aimg] =>    [aurl] => ?nid=6847   [weburl] => news.php?nid=6847   [cmtcount] => 7          )  )     )        ))


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5051575.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-16
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存