联系官方销售客服

1835022288

028-61286886

开发框架 版主:迅睿框架研发组
api取出关联的相关文章标题
类型:迅睿CMS 更新时间:2022-12-28 18:42:17

在使用api的时候怎么样直接调用管理标题呢

{"code":1,"msg":"当前是get请求方式,返回当前模板可用的变量","data":[{"id":"4","catid":"3","title":null,"thumb":null,"keywords":null,"description":null,"hits":"2","uid":"1","author":"创始人","status":"9","url":"http://www.3l8.net/index.php?c=show&id=4","link_id":"0","tableid":"0","inputip":"192.168.0.196-55793","inputtime":"2022-12-27 17:52:03","updatetime":"2022-12-27 17:52:03","displayorder":"0","chengxu":{"1":{"1":"铁板","2":"CA3301226_1","3":"10","4":"3000*1510","5":"120","6":"未开始"},"3":{"1":"铁板","2":"CA3301226_11","3":"1","4":"3000*1510","5":"10","6":"未开始"}},"khmc":"1","xiangmu":"","qgzt":"0","_inputtime":"1672134723","_updatetime":"1672134723","_chengxu":"{\"1\":{\"1\":\"铁板\",\"2\":\"CA3301226_1\",\"3\":\"10\",\"4\":\"3000*1510\",\"5\":\"120\",\"6\":\"未开始\"},\"3\":{\"1\":\"铁板\",\"2\":\"CA3301226_11\",\"3\":\"1\",\"4\":\"3000*1510\",\"5\":\"10\",\"6\":\"未开始\"}}"}]}


上面是api得到的数据 

"khmc":"1",其中的1是关联的文章id ,请问怎么样让这里显示处理的是文章的标题而不是文章的id

回帖
  • 迅睿框架联合创始人
    #1楼    迅睿框架联合创始人
    2022-12-28 17:26:35
    诺基亚手机 0
    参考文档:《回调方法的定义》 在回调函数里面做一次查询
  • 春春
    #2楼    春春
    2022-12-28 17:31:26
    Edge 0
    之前又弄了一个在里面,用于在后台调用的
    function cc_guanlian($value, $param = [], $data = [], $field = []) {
        if ($value) {
            $arr = explode(',', $value);
            if ($arr) {
                $value = '';
                foreach ($arr as $a) {
                    $a = intval($a);
                    if ($a) {
                        $value.= ','.$a;
                    }
                }
                if ($value) {
                    $value = trim($value, ',');
                    $db = \Phpcmf\Service::M()->db->query('select * from '.\Phpcmf\Service::M()->dbprefix(dr_module_table_prefix($field['setting']['option']['module'])).' where id IN ('.$value.') order by instr("'.$value.'", id)');
                    $mylist = $db ? $db->getResultArray() : [];
                    if ($mylist) {
                        $rt = '';
                        foreach ($mylist as $t) {
                            $rt.= '<a href="'.dr_url_prefix($t['url']).'">'.$t['title'].'</a>  ';
                        }
                        return $rt;
                    }
                }
            }
        }
        return dr_lang('无');
    }
    但是在api里面又不知道怎么用了 今天刚安装的api
  • 小波工作室
    #3楼    小波工作室
    2022-12-28 17:33:03
    Chrome 0
    一看函数就写错了
  • 春春
    #4楼    春春
    2022-12-28 17:38:13
    Edge 0
    小波工作室 函数错了?
  • GoWorkRoom
    #5楼    GoWorkRoom
    2022-12-28 18:00:05
    Chrome 0
    你写这个函数要改进一下
  • 春春
    #6楼    春春
    2022-12-28 18:42:17
    Edge 0
    GoWorkRoom 谢谢 其实我不懂,这也是复制的