我有以下的JSON:存儲陣列,多數民衆贊成在內側對象
"list": {
"list_id": "2kA",
"title": "Social Media",
"description": "Trending",
"image": [
"http://cdn.socialmediaexaminer.com/wp-content/uploads/2012/11/br-campaign-report.png?9d7bd4",
"http://cdn.socialmediaexaminer.com/wp-content/uploads/2012/11/br-campaign-report.png?9d7bd"
],
"views": 65
}
我怎樣才能在數據庫中存儲的圖像陣列的序列化版本?做任何以下任何返回一個錯誤:
$images = $item->list->image;
$images = $item->list->image->[0];
$images = $item->list->['image'];
謝謝你們!
無需再次序列化? JSON本身是以序列化的格式。將JSOn存儲到數據庫,並檢索時,你可以去json_decode() – 2013-02-19 06:36:37
我從一個API拉它,並在數據庫緩存結果。我將在視圖端解密JSON,但這是一個簡單的cron來緩存結果。 – viablepath 2013-02-19 06:39:06