PHP头条
热点:

ThinkPHP有变量的where条件分页实例


ThinkPHP

本文实例讲述了ThinkPHP有变量的where条件分页的实现方法。分享给大家供大家参考。

主要功能代码如下:

代码如下:


$Form= D('Announcement');
import("ORG.Util.Page");
$count = $Form->count(); //计算总数
$p = new Page ( $count, 5 );
$map = array();// 使用索引数组或者对象来作为查询条件,使用对象方式和使用数组方式的条件效果是相同的,并且是可以互换的。
$map['user_id']=$_SESSION['loginUserId']; //
$list=$Form->limit($p->firstRow.','.$p->listRows)->order('announcement_id desc')->where($map)->findAll(); //分页语句写法 where直接运用
//dump($Form->getLastSql()); //打印出sql语句
$page = $p->show (); //分页映射

希望本文所述对大家的PHP程序设计有所帮助。

www.phpzy.comtrue/phpyy/32753.htmlTechArticleThinkPHP有变量的where条件分页实例 ThinkPHP 本文实例讲述了ThinkPHP有变量的where条件分页的实现方法。分享给大家供大家参考。 主要功能代码如下: 代码如下: $Form= D('Announcement'); import("O...

相关文章

PHP之友评论

今天推荐