本文介绍了如何隐藏控制器名称在CodeIgniter的网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以事情是我使用.htaccess隐藏index.php,但我仍然得到控制器名称在url像这样: example/name_controller/about 我的问题是:是否可以隐藏控制器的名称,以便只显示方法? hxxp://example/name_controller/about
so the thing is I'm using .htaccess to hide the index.php but I still get the controller name in the url like that: example/name_controller/about My question is: is it possible to hide the name of the controller, so that only method is shown? hxxp://example/name_controller/about
推荐答案您可以在config / routes.php中定义自定义路由 - 示例:
You can define a custom route in config/routes.php - for example:
$route['about'] = 'name_controller/about'; Then, example/about goes to example/name_controller/about请参阅隐藏控制器的方法名称在网址中?在CI论坛中了解更多信息。
See Hiding the controller’s method name in the URL? in the CI forums for more information.
更多推荐
如何隐藏控制器名称在CodeIgniter的网址?
发布评论