zoukankan      html  css  js  c++  java
  • ThinkPHP的URL访问

    url访问

    http://www.kancloud.cn/manual/thinkphp5/118012
    ThinkPHP5.0在没有启用路由的情况下典型的URL访问规则是:
    http://serverName/index.php(或者其它应用入口文件)/模块/控制器/操作/[参数名/参数值...]
    注意:5.0取消了URL模式的概念,并且普通模式的URL访问不再支持,如果不支持PATHINFO的服务器可以使用兼容模式访问如下:
    http://serverName/index.php(或者其它应用入口文件)?s=/模块/控制器/操作/[参数名/参数值...]

    我想让支持/模块/控制器/操作
    修改nginx配置

    server {
            listen 80;
            server_name tp_web; #绑定域名
                    index index.htm index.html index.php; #默认文件
                    root /home/komiles/file/code/github/think-php/public; #网站根目录
            location ~ .php {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
            }
            include rewrite/tp.conf;
            if (!-f $request_filename){
                    rewrite (.*) /index.php;
            }
            access_log /data/logs/access_tp_web.log;
            error_log /data/logs/error_tp_web.log;
    }
    

    修改重写规则

    rewrite  ^(.*)$  /index.php?s=$1  last;
    

    检测nginx配置文件,重启nginx

    sudo /usr/sbin/nginx -t
    sudo  /usr/sbin/nginx -s reload
    
  • 相关阅读:
    linux 免密登录
    mysql 重置从库
    elasticsearch原理及简介
    多线程编程--心得
    为什么我们做分布式使用Redis?
    JAVA-JVM调优
    JAVA-JVM调优标志
    Spirng-Mvc之Servlet篇
    Agent Job代理 执行SSIS Package
    Python之爬虫的理解
  • 原文地址:https://www.cnblogs.com/wangkongming/p/5517452.html
Copyright © 2011-2022 走看看