我瘋了,這個我怎麼做一個foreach回聲返回slug值。php多維數組獲得價值
這是我的數組:[{"id":1,"catid":"digital-art","scategory":"3-Dimensional Art","slug":"3-dimensional-art","created_at":"2014-01-29 12:17:21","updated_at":"0000-00-00 00:00:00"}]
的print_r返回此:
Array
(
[0] => stdClass Object
(
[id] => 1
[catid] => digital-art
[scategory] => 3-Dimensional Art
[slug] => 3-dimensional-art
[created_at] => 2014-01-29 12:17:21
[updated_at] => 0000-00-00 00:00:00
)
)
你有沒有使用json_decode解析它? – Yani
不,我沒有,它在一個類中,一旦我使用JSON解碼,它返回一個錯誤。我只是做了一個打印r我更新了代碼 – cppit