本文介绍了Codeigniter中的默认路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在探索Codeigniter。在应用启动时,默认控制器已更改为加载我的控制器。I'm exploring codeigniter. On app startup default controller is changed to load my controller.控制器可以正确加载视图,这很好,所以我猜路由可以按预期工作,但是当我使用时(在同一控制器上手动在地址栏上键入其他方法)相同的网址格式/ controller / method我收到404错误,无论哪个视图都存在。Controller properly loads the view and that's fine, so I'm guessing routing works as expected, but when I use (manually type on address bar other method on same controller) same url pattern /controller/method I'm getting 404 error, either view exist.是否必须更改某些默认路由行为或其他问题?Do have to change some default routing behavior or something else is problem?谢谢推荐答案我不知道您是否已经从URL模式中删除了index.php,假设是这种情况,您应该在浏览器地址字段 index.php / controller / method 。 (如果您按照说明手动键入url)I dont know if you already removed index.php from your url pattern, assuming that's the case you should type inside browser address field index.php/controller/method. (if you manually type url as you describe)如果您不想在每个链接上使用index.php,则可以考虑将其删除,更多信息在这里。If you on the other hand do not want to use index.php on every link you can consider to remove that, more info here. 这篇关于Codeigniter中的默认路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-02 01:25