ppypp伦理天堂,91手机在线视频,免费在线观看黄色毛片,夜夜穞天天穞狠狠穞AV美女按摩

聯系官方銷售客服

1835022288

028-61286886

投訴 已解決 欄目圖片回調求解將欄目圖片轉換出來! 5 0
迅睿CMS版本:4.3.9 #欄目

欄目圖片回調求解,將欄目圖片轉換出來

"hits": "55",
            "name": {
                "id": "4",
                "pid": "1",
                "pids": "0,1",
                "name": "女生頭像",
                "dirname": "nstx",
                "pdirname": "touxiang/",
                "child": 0,
                "childids": 4,
                "thumb": "2745",
                "show": "1",
                "setting": {
                    "linkurl": "",
                    "seo": {
                        "l
                    },
本部分內容設定了隱藏,需要樓主本人才能看到
解決方案
  • public function ppp_list_data($data) {
        
            $rt = [];
            // 這里根據項目的$data輸出格式來定義PHP的數據寫法,
            // 每個接口的寫法幾乎不一樣,下面是測試例子
            if ($data['list']) {
                foreach ($data['list'] as $t) {
                    $img = [];
                    foreach ($t['images'] as $i) {
                        $img[] = dr_get_file($i['file']);
                    }
        $keywordsArr = [];
        if($t['keywords']!='')
        {
         $keywordsArr = explode(',',rtrim($t['keywords'],','));
        }
                    $rt[] = [
                        'title' => $t['title'],
                        'id' => $t['id'],
         'keywords'=>$keywordsArr,
         'comments'=>$t['comments'],
         'author'=>$t['author'],
         'avatar'=>dr_avatar($t['uid']),
         'hits'=>$t['hits'],
         'name' => dr_cat_value($t['catid']),
         'uid'=>$t['uid'],
         'catid'=>$t['catid'],
         'comments'=>$t['comments'],
         'favorites'=>$t['favorites'],
         'support'=>$t['support'],
                        'thumb' => dr_thumb($t['thumb'], 200, 200),
                        'updatetime' => dr_fdate($t['_updatetime']),
                        'images' => $img,
                    ];
                }
            }
            
            return $rt;
        }

    回復@易學習

  • 回復@易學習 這是我接口返回的數據,"thumb": "2745",就是要轉換的欄目地址。是這個參數里面的

    'name' => dr_cat_value($t['catid']),

    "data": [
            {
                "title": "小葵好可愛哦!",
                "id": "604",
                "keywords": [
                    "可愛"
                ],
                "comments": "0",
                "author": "夢",
                
                "hits": "5",
                "name": {
                    "id": "9",
                    "pid": "2",
                    "pids": "0,2",
                    "name": "動漫壁紙",
                    "dirname": "dongmanbizhi",
                    "pdirname": "bizhi/",
                    "child": 0,
                    "childids": 9,
                    "thumb": "2745",
                    "show": "1",
                    "setting": {
                        "linkurl": "",
                        "seo": {
                            
                        },
                        "template": {
                            "pagesize": "10",
                            "mpagesize": "10",
                            "list": "list.html",
                            "category": "category.html",
                            "search": "search.html",
                            "show": "show.html"
                        },
                        "cat_field": null,
                        "html": 0,
                        "urlrule": 3
                    },
                    "displayorder": "0",
                    "mid": "p",
                    "topid": "2",
                    "domain": "",
                    "mobile_domain": "",
                    "catids": [
                        "9"
                    ],
                    "tid": 1,
                    "permission": [
                        
                    ],
                    "url": "/p/dongmanbizhi.html",
                    "total": 73,
                    "field": [
                        
                    ]
                },
                "uid": "1",
                "catid": "9",
                "favorites": "0",
                "support": "0",
                "thumb": "/static/assets/images/nopic.gif",
                "updatetime": "3天前",
                "images": [
                    
                ]
            },
  • public function ppp_list_data($data) {
        
            $rt = [];
            // 這里根據項目的$data輸出格式來定義PHP的數據寫法,
            // 每個接口的寫法幾乎不一樣,下面是測試例子
            if ($data['list']) {
                foreach ($data['list'] as $t) {
                    $img = [];
                    foreach ($t['images'] as $i) {
                        $img[] = dr_get_file($i['file']);
                    }
        $keywordsArr = [];
        if($t['keywords']!='')
        {
         $keywordsArr = explode(',',rtrim($t['keywords'],','));
        }
        $cat = dr_cat_value($t['catid']);
        $cat['thumb'] = dr_get_file($cat['thumb']);
                    $rt[] = [
                        'title' => $t['title'],
                        'id' => $t['id'],
         'keywords'=>$keywordsArr,
         'comments'=>$t['comments'],
         'author'=>$t['author'],
         'avatar'=>dr_avatar($t['uid']),
         'hits'=>$t['hits'],
         'name' =>  $cat,
         'uid'=>$t['uid'],
         'catid'=>$t['catid'],
         'comments'=>$t['comments'],
         'favorites'=>$t['favorites'],
         'support'=>$t['support'],
                        'thumb' => dr_thumb($t['thumb'], 200, 200),
                        'updatetime' => dr_fdate($t['_updatetime']),
                        'images' => $img,
                    ];
                }
            }
            
            return $rt;
        }

    這是php基礎語法了

    滿意答案
    短信幣+1
  • @九戒:正確,非常感謝!