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会有上述问题:

解决方案 »

  1.   

    tp3.2有模块的概念
    url路由这样
    http://xx.com/home/user/index
    而tp3.1是
    http://xx.com/user/index<a href="{:U('Home/User/index')}">登陆</a>
    检查下你的地址是否有问题。
      

  2.   

    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;
    }