【发布时间】:2011-09-16 08:07:00
【问题描述】:
这是我的 CodeIgniter 控制器类代码。
class View extends MY_Controller
{
function index($number)
{
.....
}
.......
}
通过浏览器,我可以使用这个 URL 访问 View 类的 index 方法
http://localhost/view/index/12
所以,我的问题是
有没有什么有效的方法可以把网址改写成这个网址
http://localhost/view/12
我的网络服务器是 Nginx。
【问题讨论】:
-
您应该可以直接访问localhost/view/12。它默认为 index()。
-
hmm.. 不,它在我的服务器中产生 404 错误。 -_-;不知道为什么?
-
我认为这两个答案是正确的。它只对我有用 .htaccess
标签: php codeigniter url-rewriting nginx