我目前的URI是什么样子:localhost/home/saved
,localhost/home/view
我希望它是什么样子:localhost/saved
,localhost/view
。
我的home
控制器是什么样的:
class Home extends CI_Controller
{
public function index() {
//stuff
}
public function saved() {
//stuff
}
public function view() {
//stuff
}
}
我想摆脱home
URL中的,这样用户就可以直接访问localhost/saved
和我家中的其他功能,而无需home
在URL中键入。
我尝试将这些routes.php
文件放入文件中,但是没有运气。
$route['home/(:any)'] = "$1";
//that didn't work so I tried putting this:
$route['home/(:any)'] = "/$1";
//that didn't work either.
非常感谢您的帮助。谢谢!
试试这个
$route['saved'] = 'home/saved';
$route['view'] = 'home/view';
输出-
www.example.com/saved
和www.example.com/view
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句