关于thinkphp 3.2.3 nginx U方法的问题求助

sopop 2016-01-29 07:10:23
3.2.3 U方法在windows的wamp使用正常,在centos的lnmp就出问题了。用'URL_MODEL'=> 2,打开首页(www.xxx.om)正常,可以再打开(www.xxx.com/Index/news.html),再开一个问题来了(www.xxx.com/Index/Index/about.hmtl)。就这样不断增加Index/(www.xxx.com/Indx/Index/……/Index/product.html),如用'URL_MODEL' => 3,就变成(www.xxx.com/.php?s=/),index.php的index不见了;用回3.1.3就不会出现这种问题。谢谢各位帮助了!
nginx下的tp3.1.3可正常打开所有链接:

nginx下的tp3.2.3会有上述问题:


...全文
487 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
哥们,咋解决的啊!!!!急
sopop 2016-01-31
  • 打赏
  • 举报
回复
3.2.3 U方法在windows的wamp使用正常,在centos的lnmp就出问题了!! 项目里面的config是这样的: <?php return array( 'URL_MODEL' => 2, // URL访问模式,可选参数0、1、2、3,代表以下四种模式: // 0 (普通模式); 1 (PATHINFO 模式); 2 (REWRITE 模式); 3 (兼容模式) 'MODULE_ALLOW_LIST' => array('Admin','Web'), 'DEFAULT_MODULE'=>'Web',//默认模板 //'APP_USE_NAMESPACE' => false, // 应用类库是否使用命名空间 'SHOW_PAGE_TRACE' => true, //显示页面跟踪 'TMPL_ACTION_ERROR' => 'Public:jump',//默认错误跳转对应的模板文件 'TMPL_ACTION_SUCCESS' => 'Public:jump',//默认错误跳转对应的模板文件 ); nginx 的 conf是这样设置的: server{ listen 80; #listen [::]:80; server_name zq.xxx.cn; index index.html index.htm index.php default.html default.htm default.php; root /data/www/thinkphp/; include other.conf; error_page 404 /404.html; if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; break; } location ~ \.php { #comment try_files $uri =404; to enable pathinfo try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; #include pathinfo.conf; #定义变量 $path_info set $path_info ""; #定义变量 $real_script_name,用于存放真实地址 set $real_script_name $fastcgi_script_name; #如果地址与引号内的正则表达式匹配 if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { #将文件地址赋值给变量 $real_script_name set $real_script_name $1; #将文件地址后的参数赋值给变量 $path_info set $path_info $2; } #配置fastcgi的一些参数 fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /mnt/data/wwwlogs/zq.log access; }
码无边 2016-01-30
  • 打赏
  • 举报
回复
tp3.2有模块的概念 url路由这样 http://xx.com/home/user/index 而tp3.1是 http://xx.com/user/index <a href="{:U('Home/User/index')}">登陆</a> 检查下你的地址是否有问题。

21,887

社区成员

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

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