Maison  >  Article  >  développement back-end  >  thinkphp在查询时遇到排名与分页问题

thinkphp在查询时遇到排名与分页问题

WBOY
WBOYoriginal
2016-08-04 09:20:411023parcourir

两表关联查询出数据时排名会被分页page影响,只在当前分页进行排名,怎么解决这个问题?thinkphp在查询时遇到排名与分页问题

thinkphp在查询时遇到排名与分页问题

thinkphp在查询时遇到排名与分页问题

回复内容:

两表关联查询出数据时排名会被分页page影响,只在当前分页进行排名,怎么解决这个问题?thinkphp在查询时遇到排名与分页问题

thinkphp在查询时遇到排名与分页问题

thinkphp在查询时遇到排名与分页问题

oc_member表增加total_bean字段,随时更新。

创建视图 ,由于SQL语句比较复杂 ,TP支持不好,所以将复杂的SQL做成视图 ,简化TP中执行的SQL语句 ,然后在TP中通过视图查询得到结果
$Model=D("BlogView");
$Model->where($where)->page($page,$end)->select();

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn