用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1395|回复: 4
收起左侧

[已解决] 小白问题,url调用控制器类/方法

[复制链接]
发表于 2016-8-5 16:10:44 | 显示全部楼层 |阅读模式
如题,比如我想访问控制器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;
        root  c:/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;  
        }
        
         
    }
 楼主| 发表于 2016-8-5 16:45:58 | 显示全部楼层
已经解决 就nginx配置问题
发表于 2016-8-5 17:07:23 | 显示全部楼层
这个是去掉 index.php 的问题,论坛很多解决方案。
 楼主| 发表于 2016-8-5 18:09:58 | 显示全部楼层
Hex 发表于 2016-8-5 17:07
这个是去掉 index.php 的问题,论坛很多解决方案。

论坛的 好多不能解决 ,具体怎么改nginx或者Apache配置问题也没有。
发表于 2016-8-10 11:15:39 | 显示全部楼层
ming862394769 发表于 2016-8-5 18:09
论坛的 好多不能解决 ,具体怎么改nginx或者Apache配置问题也没有。

其实 nginx 官方已经给出了配置了,看下 nginx wiki。

本版积分规则