CI URL 可以这样定义不
controller : apimethod : 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框架下有办法实现没有 http://localhost/codeigniter/index.php/api/index/1 也不可以吗
http://localhost/codeigniter/index.php/api/index?param=12 也可以。404得看你的服务器了 CI的url不是已经有规定了吗
BASE_URL/index.php/controller/function/param1/param2/param3/...
其中 index.php 是可以通过设置 改为不需要出现在 url的
如果要调用的部分是controller的index 就不要controller 后面的部分
如果是指定到function 至少是 BASE_URL/index.php/controller/function/
如果该function 有参数就继续传 /param1/param2/param3/...
有几个传几个 楼主是想开启query string?
application\config\config.php里面改这个配置项
$config['enable_query_strings'] = TRUE;
我用mssql数据库,分页就用的就是这个,没问题呀 config.php 里 URI协议改成 PATH_INFO 试试。
页:
[1]