crisenchou
- crisenchou 2017-07-14 已签到连续签到1天,获得了5个金钱
- crisenchou 2017-04-15 已签到连续签到1天,获得了5个金钱
- crisenchou 2017-03-14 已签到连续签到2天,获得了10个金钱
- crisenchou 2017-03-13 已签到连续签到1天,获得了5个金钱
- crisenchou 2017-03-11 已签到连续签到3天,获得了15个金钱
- crisenchou 2017-03-10 已签到连续签到2天,获得了10个金钱
- crisenchou 2017-03-09 已签到连续签到1天,获得了5个金钱
- crisenchou 2017-03-07 已签到连续签到1天,获得了5个金钱
- crisenchou 回复了 crisenchou 的回答
我发现这个答案现在还不是很完整,再补充一点好了,经过我的研究,我发现这玩意光靠框架本身是没有办法独自完成工作的,需要在服务器做配置
nginx配置的话需要加上if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php last; }
如果是apache服务器的话 楼上的仁兄已经给出了答案了
具体就是要忽视文件不存在的情况还有一点,通过阅读urlManager这个类的源码,enablePrettyUrl 这个参数是必须是true才可以
你看看apache的配置中有没有启用
LoadModule rewrite_module modules/mod_rewrite.so
要启用重写需要在apache的http.conf中 启用rewite mod 我发现这个答案现在还不是很完整,再补充一点好了,经过我的研究,我发现这玩意光靠框架本身是没有办法独自完成工作的,需要在服务器做配置
nginx配置的话需要加上if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php last; }
如果是apache服务器的话 楼上的仁兄已经给出了答案了
具体就是要忽视文件不存在的情况还有一点,通过阅读urlManager这个类的源码,enablePrettyUrl 这个参数是必须是true才可以