小白问题,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;
}
} 已经解决 就nginx配置问题 这个是去掉 index.php 的问题,论坛很多解决方案。 Hex 发表于 2016-8-5 17:07
这个是去掉 index.php 的问题,论坛很多解决方案。
论坛的 好多不能解决 ,具体怎么改nginx或者Apache配置问题也没有。 ming862394769 发表于 2016-8-5 18:09
论坛的 好多不能解决 ,具体怎么改nginx或者Apache配置问题也没有。
其实 nginx 官方已经给出了配置了,看下 nginx wiki。
页:
[1]