无刷新点击实现加载更多数据
public function more(){
$page = intval($_GET["page"]); //获取请求的页数
$cid = intval($_GET["cid"]); //分类id
$pagenum = 8; //每页数量
$start = ($page - 1) * $pagenum;
$tag = "order:post_date desc;limit:$start,$pagenum";
$result = sp_sql_posts_bycatid($cid,$tag);
foreach ($result as &$value) {
$value["smeta"]=json_decode($value["smeta"], true);
$value["thumb"]=$value["smeta"]["thumb"];
$term_id=$value["term_id"];
$term=sp_get_term($term_id);
$value["claname"]=$term["name"];
}
if ($result) {
echo json_encode($result,true); //转换为json数据输出
}
}