您现在的位置是:首页 > PHP技术PHP技术
Thinkphp5.1.30 分页think\paginator\driver\Bootstrap has no effect解决
2018-12-11【PHP技术】4328 人已围观
简介 Tp5.1.30对以往版本有很大的改进。$list = Db:name('表名')->pagina...
Tp5.1.30对以往版本有很大的改进。
$list = Db:name('表名')->paginate(10); 返回的不再是数组。是一个collection. 以往我们对已取得的数据插入新字段名称时用到foreach
tp5.1.x 结果报错 Indirect modification of overloaded element of think\paginator\driver\Bootstrap has no effect
解决办法:
//省略前部分代码....... $list = Db::name('ads') ->where($whr) ->paginate(10,false,[ 'query'=> Request::param() ]); $list_copy = $list->toArray(); //把原list转换成数组,并且copy一份 foreach ($list_copy['data'] as $k=>$v){ $list_copy['data'][$k]['class_name_cn'] = $this->getClassName($v['class_id']); } $this->assign('list',$list); //前台使用此变量完成分页和手册一样 $this->assign('lsit_copy',$list_copy); //注意前台使用此变量进行数据循环,
模版部分
volist name='使用复制的list'
分页使用默认的list
{$list|raw}
关注宁波网站建设博客,更多精彩分享,敬请期待!
Tags:
很赞哦! ()
相关文章
随机图文
在HTML中引入css的其中的两个方法
1在HTML中引入css的其中的两个方法1.1 使用链接式link href="style.css" rel="...mysql常见的多表查询语句
select*fromTable1,Table2whereTable1.id=1andTbale2.id-2(是某一相同字段)注意这样的查询...thinkphp imagettftext(): Could not find/open font验证码无法显示报错
thinkphp imagettftext(): Could not find/open font tp5.1验证码无法显示.打开debu...Thinkphp5.1 截取新闻标题长度的办法
tp5.1和原生php一样,在截取新闻标题长度的时候都是一样的考虑.中文在字符串的处理中比英文要多考虑一些东西,因为英文占一个位,中文占...