关于thinkPHP 中的分页搜索

浏览:4043 发布日期:2013/12/16 分类:求助交流 关键字: 分页 传参
[code]这个是我的处理搜索分页的代码块
// 搜索查询
if($_REQUEST['cid'] !== '-'){
$cid = $_REQUEST['cid'];
}
$where = array();
if($_REQUEST['search']){
$schtitle = $_REQUEST['schtitle']; // 标题
$schAuthor = $_REQUEST['schAuthor']; // 作者
$schTime = urldecode($_REQUEST['schTime']); //时间
$time = strtotime($schTime);
$schStatus = $_REQUEST['schtitle']; // 状态
if($schtitle){
$where['title'] = array('like','%'.$schtitle.'%');
}
if($schAuthor){
$where['author'] = array('like','%'.$schAuthor.'%');
}
if($schTime){
$where['pubtime'] = array('egt',$time);
}
if($schStatus !== '-' && $schStatus == 0){
$where['status'] = 0;
}
if(!empty($schStatus) && $schStatus == 1){
$where['status'] = 1;
}
}
if($cid){
$where['cid'] = $cid;
}
$count = $article->where($where)->count();
$Page = new Page($count,1);
$Page->parameter='';
//foreach($where as $key=>$val) {
//$Page->parameter .= "$key=".urlencode($val).'&';
//}

$result = $article->field('id,title,cid,pubtime,sort,status,clicks')->where($where)->limit($Page->firstRow.",".$Page->listRows)->order('sort')->select();
var_dump($article->getLastSql());

当我使用 这个来传递分页参数时,点击下页时,使用$_GET 却获取不到值
foreach($where as $key=>$val) {
$Page->parameter .= "$key=".urlencode($val).'&';
}
而把 上面的 改成 :$page->parameter = '' 这个分页参数的值写为空时,我的搜索功能 ,便可以使用了。。。。


这个与手册里说的明显不符合 ,
敢问各位大侠高手 可遇到过类似的问题 ,

求个给位大神给个指导。。。。。[code]
最佳答案
评论() 相关
后面还有条评论,点击查看>>