ming862394769 发表于 2016-8-5 16:10:44

小白问题,url调用控制器类/方法

如题,比如我想访问控制器index.php中的test方法 ,我需要 http://localhost/index.php?/index/test或者http://localhost/?/index/test 这样才可以,但不想idnex.php?或者?这些 就直接/index/test 这样访问 该怎么改
我nginx.conf配置是这样的server {
      listen      80;
      server_name shop.com;
      rootc:/work/shop;
         index        index.php index.html;
      location / {
            try_files $uri $uri/ /index.php;      
      }

       location ~*\.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }
      
         
    }

ming862394769 发表于 2016-8-5 16:45:58

已经解决 就nginx配置问题

Hex 发表于 2016-8-5 17:07:23

这个是去掉 index.php 的问题,论坛很多解决方案。

ming862394769 发表于 2016-8-5 18:09:58

Hex 发表于 2016-8-5 17:07
这个是去掉 index.php 的问题,论坛很多解决方案。

论坛的 好多不能解决 ,具体怎么改nginx或者Apache配置问题也没有。

Hex 发表于 2016-8-10 11:15:39

ming862394769 发表于 2016-8-5 18:09
论坛的 好多不能解决 ,具体怎么改nginx或者Apache配置问题也没有。

其实 nginx 官方已经给出了配置了,看下 nginx wiki。
页: [1]
查看完整版本: 小白问题,url调用控制器类/方法