用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1055|回复: 2
收起左侧

[版本 3.x] CI如何支持app1/controller1/action1?para1=1&para=2

[复制链接]
发表于 2015-12-15 00:44:13 | 显示全部楼层 |阅读模式
CI如何支持app1/controller1/action1?para1=1&para=2,这类URI模式

即一个index.php控制多个application(多个application安排多个人开发);
para1,para2,指明可以清晰知道方法要传的参数,方便交流,

感觉还是需要开发很多
发表于 2015-12-15 10:21:25 | 显示全部楼层
传参数是绝对没问题的   对于多个App 你可以看看手册就行了   
 楼主| 发表于 2015-12-15 17:30:32 | 显示全部楼层
本帖最后由 大侠是我 于 2015-12-15 17:31 编辑

自己回复一下,希望版主加精,首先解决多app部署的问题(后续再解决查询字段的问题,不希望查询字段中需要包含c和a)

n 新建“template”目录,并把原来的“application”目录和“index.php”文件放入其中
Ø 修改此“index.php”文件,把“$system_path”改为“../system
Ø 修改“application/config/config.php”文件,把“$config['index_page']”改为“'../template/index.php'(每复制“template”目录增加一个新app时都需要进行此步骤,并其中template换成增加的app的名字,即'../template/index.php'”,““'../app/index.php'””)
Ø sae上需要修改“config.yaml”文件,增加rewrite规则,注意顺序!例如:
- rewrite: if (!-f && %{REQUEST_URI} ~ "template/index.php/(.*)") goto "/template/index.php/%1"
- rewrite: if (!-f && %{REQUEST_URI} ~ "template/(.*)") goto "/template/index.php/%1"
- rewrite: if (!-f && %{REQUEST_URI} ~ "app1/index.php/(.*)") goto "/app1/index.php/%1"
- rewrite: if (!-f && %{REQUEST_URI} ~ "app1/(.*)") goto "/app1/index.php/%1"
l PS:如果不在sae上部署,只要增加.htacess文件即可

D:\QQ图片20151215172744.jpg

本版积分规则