api.php
if(isset($_GET['cat_id']))
{
//$query="SELECT id,title,images,category,date,state FROM news WHERE category='".$_GET['cat_id']."' ORDER BY id DESC LIMIT 100";
//$resouter = mysql_query($query);
$query="SELECT id,title,images,category,date,state FROM category c, news n WHERE c.category=n.category and c.id='".$_GET['cat_id']."' ORDER BY n.id DESC LIMIT 100";
$resouter = $db->query($query);
}
$set = array();
$total_records = $resouter->num_rows;
if($total_records >= 1){
while ($link = $resouter->fetch_array(MYSQLI_ASSOC)){
$set['NewsApp'][] = $link;
}
}
echo $val = str_replace('\\/', '/', json_encode($set,JSON_UNESCAPED_UNICODE));
但是当我跑到api.php?cat_id=1
时,只显示[]
这样的话。可以请别人帮帮我吗?
...问候