Home > Backend Development > PHP Tutorial > CI URL 可以这么定义不

CI URL 可以这么定义不

WBOY
Release: 2016-06-13 12:59:58
Original
977 people have browsed it

CI URL 可以这样定义不

本帖最后由 wdvill 于 2012-03-04 02:57:39 编辑 controller : api
method : index

在这个方法里,我想用GET传一个参数,URL如下,结果不可以,报404错误,这是为什么
http://localhost/codeigniter/index.php/api/index?param=12

但是我把 ?  号后面的去掉变为
http://localhost/bubblewitch/index.php/api/index
就能访问了,但是我想传参进去
虽然这样传也可以  http://localhost/codeigniter/index.php/api/index/param/12 
但是我不想弄成这样


我问下如果我要按第一种带 ? 的URL 去访问在CI框架下有办法实现没有
------解决方案--------------------
CI的时候使用到了路由功能,就是在用户配置文件config下的route.php中设置自己的路由规则,你看下$route['thumb/(:any)'] = "category/thumb/$1";这个数组能不能做下调整,变成你想要的那种方式
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template