首页 > 其他分享 >后台列表字段-回调函数-关联字段显示标题

后台列表字段-回调函数-关联字段显示标题

时间:2023-01-29 20:22:23浏览次数:36  
标签:rt arr mylist 函数 db value 列表 字段 后台

回调函数名称:

 
xb_admin_guanlian

  

回调函数代码(文件:config/custom.php):

 
function xb_admin_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('无');
}

  

标签:rt,arr,mylist,函数,db,value,列表,字段,后台
From: https://www.cnblogs.com/nice2018/p/17073748.html

相关文章