Menu

tp5中分页后怎么处理items数据?thinkphp5处理分页后的数据

发布时间:2019-10-10 11:45:29作者:米醋儿热度: 423 ℃

tp5中分页后怎么处理items数据?thinkphp5处理分页后的数据 下面是demo

 $list = Db::name("content")
            ->where("createdby",$u["admin_userid"])
            ->order("contentid DESC")
            ->paginate($limit);
        $list = json_encode($list);
        $list = json_decode($list,true);
        $temp = $list["data"];
        foreach ($temp as $k => $v){
            $temp[$k]["thumb"] = "https://upload.qudong.com/".$v["thumb"];
        }
        $list["data"] = $temp;

        if($list){
            return json(array("code"=>200,"msg"=>"获取成功","data"=>$list));
        }else{
            return json(array("code"=>400,"msg"=>"bad request","data"=>""));
        }

米醋儿 micuer.com