联系官方销售客服
1835022288
028-61286886
请教一下Table类里的_List()方法中的$p参数怎么用。
\dairui\Fcms\Core\Table.php 里定义了_List()方法,如下:
protected function _List($p = [], $size = 0) { // 分页数量控制 if (!$this->list_pagesize) { if (!$size) { if (IS_ADMIN) { $size = (int)SYS_ADMIN_PAGESIZE; } else { $size = (int)$this->member_cache['config']['pagesize']; if (IS_API_HTTP) { $size = (int)$this->member_cache['config']['pagesize_api']; } elseif (\Phpcmf\Service::IS_MOBILE()) { $size = (int)$this->member_cache['config']['pagesize_mobile']; } } } !$size && $size = 10; } else { $size = $this->list_pagesize; } // 查询数据结果 list($list, $total, $param) = \Phpcmf\Service::M()->init($this->init)->limit_page($size); $p && $param = $p + $param; $sql = \Phpcmf\Service::M()->get_sql_query(); // 分页URL格式 $this->url_params && $param = dr_array22array($param, $this->url_params); $uri = \Phpcmf\Service::L('Router')->uri(); $url = IS_ADMIN ?\Phpcmf\Service::L('Router')->url($uri, $param) :\Phpcmf\Service::L('Router')->member_url($uri, $param); $url = $url.'&page={page}'; // 分页输出样式 if (IS_ADMIN) { $config = require CMSPATH.'Config/Apage.php'; } else { $file = 'config/page/'.(\Phpcmf\Service::IS_PC() ? 'pc' : 'mobile').'/member.php'; if (is_file(WEBPATH.$file)) { $config = require WEBPATH.$file; } elseif (is_file(ROOTPATH.$file)) { $config = require ROOTPATH.$file; } else { exit('无法找到分页配置文件【'.$file.'】'); } } // 存储当前页URL \Phpcmf\Service::L('Router')->set_back(\Phpcmf\Service::L('Router')->uri(), $param); $list_field = []; // 筛选出可用的字段 if ($this->init['list_field']) { foreach ($this->init['list_field'] as $i => $t) { $t['use'] && $list_field[$i] = $t; } } // 默认显示字段 !$list_field && $this->init['show_field'] && $list_field = [ $this->init['show_field'] => [ 'name' => dr_lang('主题'), 'func' => 'title', 'width' => 0, ], ]; // 查询表名称 $list_table = \Phpcmf\Service::M()->dbprefix($this->init['table']); if (isset($this->init['join_list'][0]) && $this->init['join_list'][0]) { $list_table.= ','.\Phpcmf\Service::M()->dbprefix($this->init['join_list'][0]); } // 返回数据 $data = [ 'list' => $list, 'total' => $total, 'param' => $param, 'mypages' => \Phpcmf\Service::L('input')->table_page($url, $total, $config, $size), 'my_file' => $this->_tpl_filename('table'), 'uriprefix' => trim(APP_DIR.'/'.\Phpcmf\Service::L('Router')->class, '/'), // uri前缀部分 'list_field' => $list_field, // 列表显示的可用字段 'list_query' => urlencode(dr_authcode($sql, 'ENCODE')), // 查询列表的sql语句 'list_table' => $list_table, // 查询列表的数据表名称 ]; \Phpcmf\Service::V()->assign($data); return [$this->_tpl_filename('list'), $data]; }
请问这个函数里的参数$p该怎么用?看到官方在\dairui\Fcms\Control\Admin\Comment.php中是这么用的:
// 后台查看列表 protected function _Admin_List() { list($tpl) = $this->_List(['cid' => $this->cid]); \Phpcmf\Service::V()->assign([ 'p' => ['cid' => $this->cid], ]); \Phpcmf\Service::V()->display($tpl); }
其中的list($tpl) = $this->_List(['cid' => $this->cid]); 传了一个array参数,但是我试了一下这里传不传这个参数都没任何影响,正在学习迅睿二开,请各位不吝赐教。@迅睿框架创始人
但是分页url里并没有任何体现啊?我测试把里边参数都删了也没有任何变化。http://***.com/szxww168.php?s=news&c=comment&m=index&cid=1140&total=11&order=inputtime+desc&page=2麻烦迅睿框架创始人 帮忙看一下