CodeIgniter: Page not found when passing parameters to a controller?

牧云@^-^@ 提交于 2019-12-06 13:41:24

With that URL, CodeIgniter can't understand if you want to pass 123 to the index method or if you're requesting the 123 method with no parameters. You have to explicitly name the default method if you need to pass it some parameters.

http://mysite/index/123

Option 1 - Rempap the function call in your controller

If your controller contains a function named _remap(), it will always get called regardless of what your URI contains. It overrides the normal behavior in which the URI determines which function is called, allowing you to define your own function routing rules. http://codeigniter.com/user_guide/general/controllers.html#remapping

Option 2 - Use a custom route.

http://codeigniter.com/user_guide/general/routing.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!