所以这是查看我的 json 文件的地方:http: //alyssayango.x10.mx/
这是我的 php 文件:
<?php
include('connectdb.php');
$sql = "SELECT * FROM tblmovies ORDER BY _id";
$result = mysql_query($sql);
if($result === FALSE) {
die(mysql_error()); // TODO: better error handling
}
$set = array();
while($row1 = mysql_fetch_assoc($result)) {
$set[] = $row1;
}
echo json_encode($set);
输出是:
[{"_id":"3","movie_name":"Despicable Me 2","movie_cinema_number":"CINEMA 1","movie_length":"1hr. 40mins.","movie_type":"GP","movie_schedules":"12:10 PM | 02:25 PM | 04:40 PM","movie_image_url":"http:\/\/i39.tinypic.com\/szizo4.jpg"},{"_id":"4","movie_name":"White House Down","movie_cinema_number":"CINEMA 2","movie_length":"2 hrs. 10 mins.","movie_type":"PG-13","movie_schedules":"12:30 PM | 03:20 PM | 06:10 PM","movie_image_url":"http:\/\/i39.tinypic.com\/vp9n9j.jpg"},{"_id":"5","movie_name":"My Lady Boss","movie_cinema_number":"CINEMA 3","movie_length":"1hr. 50 mins.","movie_type":"PG-13","movie_schedules":"01:00 PM | 03:30 PM | 06:00 PM","movie_image_url":"http:\/\/i44.tinypic.com\/2qlv08z.jpg"},{"_id":"6","movie_name":"Four Sisters And A Wedding","movie_cinema_number":"CINEMA 4","movie_length":"2 hrs. 5 mins. ","movie_type":"PG-13","movie_schedules":"12:30 PM | 03:10 PM | 05:50 PM","movie_image_url":"http:\/\/i44.tinypic.com\/9iv0d1.jpg"}]
我在这里做的似乎有什么问题?URL 显示为:http:\ /\ /i44.tinypic.com\ /9iv0d1.jpg 其中应该是http://i44.tinypic.com/9iv0d1.jpg