PHP:$ result = mysql_query(「SELECT * FROM events LIMIT 15」);使用PHP簡單創建JSON
任何人都可以幫助並告訴我如何創建json,看起來像上面的php查詢完全一樣嗎?
{
"events": [
{
"id": 2,
"name": "TIME",
"image": "http://127.0.0.1/android_tests_json_and_xml/images/time_best.jpg",
"status": "30 years of Cirque du Soleil's best photos",
"profilePic": "http://127.0.0.1/android_tests_json_and_xml/images/time.png",
"timeStamp": "1403375851930",
"url": "http://ti.me/1qW8MLB"
},
{
"id": 3,
"name": "Discovery",
"image": "http://127.0.0.1/images/discovery_mos.jpg",
"status": "A team of Austrian scientists has developed a laser system that causes fruit flies to dance.",
"profilePic": "http://127.0.0.1/android_tests_json_and_xml/images/discovery.jpg",
"timeStamp": "1403375851930",
"url": "http://dsc.tv/xmMxD"
},
{
"id": 11,
"name": "A. R. rahman",
"image": "http://127.0.0.1/images/ar_bw.jpg",
"status": "",
"profilePic": "http://127.0.0.1/android_tests_json_and_xml/images/ar.jpg",
"timeStamp": "1403375851930",
"url": ""
}
]
}
我會很感激
用更多的代碼編輯 – 2015-04-03 10:14:58