CI URL 可以这样定义不解决方法

WBOY
Release: 2016-06-13 10:12:05
Original
1040 people have browsed it

CI URL 可以这样定义不
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