thinphp 分页问题

fitchliu 2017-02-07 09:29:55
在搜索功能里搜索用户。 然后分页。在第一页的路径是/weibo/index.php/Search/sechUser?keyword=ad 点击第二页的时候变成/weibo/index.php/Search/sechUser/keyword/ad/p/2。 点击之后可是并不跳转页面。
这是php代码 public function sechUser(){
$keyword=$this->_getKeyword();//_getKeyword()是返回关键字的函数
if($keyword){
//检索出除自己外昵称含有关键字的用户
$where=array(
'username'=>array('LIKE','%'.$keyword.'%'),
'uid'=>array('NEQ',session('uid'))

);
$field=array('username','sex','location','info','face80','follow','fans','weibo','uid');
$db=M('userinfo');


import('ORG.Util.Page');// 导入分页类
$count=$db->where($where)->count('id');
$page=new Page($count,1);
$limit=$page->firstRow.','.$page->listRows;

$result=$db->where($where)->field($field)->limit($limit)->select();

//重新组合结果集 得到是否已关注与是否互相关注
$result=$this->_getMutual($result);
//分配搜索结果到视图
$this->result=$result? $result:false;
//页码

$this->page=$page->show();
//p($result);die;
}
$this->keyword=$keyword;
$this->display();
}
我在配置里设置了路由模式'URL_MODEL' => 1,可是第二页的路由不能变为/weibo/index.php/Search/sechUser?keyword=ad&&p=2,这个怎么解决????
...全文
202 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
傲雪星枫 2017-02-11
  • 打赏
  • 举报
回复
你先设置服务器支持pathinfo吧 http://blog.csdn.net/mengxiangbaidu/article/details/7496859
fitchliu 2017-02-10
  • 打赏
  • 举报
回复
引用 3 楼 fdipzone 的回复:
https://zhidao.baidu.com/question/1990820665612034547.html
我知道路由的模式 可是 我试过了 这三个 都不行。楼上 能不能给个具体点的方法
傲雪星枫 2017-02-09
  • 打赏
  • 举报
回复
很明显,你的环境不支持PathInfo模式。
komyluo 2017-02-09
  • 打赏
  • 举报
回复
1就是这样,0才能变成你要的样式

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧