thinkphp 分页后生成的路径不对,需要怎么调试呢

原创
2016-06-23 13:17:26 924浏览

以下是自动生成后的分页路径
下一页
改路径是错误的
正确的路径应该是
下一页
这样就是可以的了,可它自己在生成的时候就少个index.php 块


这个是分页

class MemberAction extends Action {
function index(){
$member = D('admin');
import('ORG.Util.Page');
$count=$member->count();
$page = new Page($count,2);//
$page->setConfig('header','条信息');
$show=$page->show();//返回分页信息

$list=$member->limit($page->firstRow.','.$page->listRows)->select();
$this->assign('mlist',$list);
$this->assign('show',$show);
$this->display();

}


回复讨论(解决方案)

为什么你没有用 url 重写隐去 index.php 呢?

   RewriteEngine on   RewriteCond %{REQUEST_FILENAME} !-d   RewriteCond %{REQUEST_FILENAME} !-f   RewriteRule ^(.*)$ index.php/$1 

把这代码放到你thinkphp根目录下的.htaccess中 重写下url

   RewriteEngine on   RewriteCond %{REQUEST_FILENAME} !-d   RewriteCond %{REQUEST_FILENAME} !-f   RewriteRule ^(.*)$ index.php/$1 

把这代码放到你thinkphp根目录下的.htaccess中 重写下url


按照你的方式我也试了,可是它的分页自己生成的路径还是以前那样子的

只要你的 url 重写生效
/thinkphp/Member/index/p/3.htm
就会重写为
/thinkphp/index.php/Member/index/p/3.html
所以有没有 index.php 都是一样的

当然,如果你的重写没有生效,那么就不对了
那么首次进入时的 url 又是什么样子的呢?

如果重写时生效的,但
thinkphp/Member/index/p/3.htm
是真实存在的话,那就是你的问题了:生成的静态文件与动态发生冲突了

只要你的 url 重写生效
/thinkphp/Member/index/p/3.htm
就会重写为
/thinkphp/index.php/Member/index/p/3.html
所以有没有 index.php 都是一样的

当然,如果你的重写没有生效,那么就不对了
那么首次进入时的 url 又是什么样子的呢?

如果重写时生效的,但
thinkphp/Member/index/p/3.htm
是真实存在的话,那就是你的问题了:生成的静态文件与动态发生冲突了




搞定了,初次用thinkphp 做东西》。。

请问 如何解决的?配置下面的没有解决。。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1

~
~

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。