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

[HELP] 如何区分是文件夹还是控制器呢?

[复制链接]
发表于 2011-5-3 21:37:50 | 显示全部楼层 |阅读模式
本帖最后由 wyangu 于 2011-5-3 22:04 编辑

rt
example.com/index.php/products/shoes/show/123

这个路径可以理解为  products 文件夹下的shoes控制器 也可以理解为
products为控制器 shoes为方法 show和123为参数

如何区分呢?
ci优先原则会认为products为控制器。
如果现在情况是products为文件夹 shoes为控制器 show为方法 123为参数

如果出现这种情况怎么办
products为控制器 shoes方法 show和123为参数
现这种条件下是不是就要出现覆盖的情况
发表于 2011-5-4 10:38:33 | 显示全部楼层
默认的都是products为控制器 shoes为方法 吧,如果product为文件夹不是应该在index.php前面吗?
发表于 2011-5-4 20:08:01 | 显示全部楼层
PHP复制代码
 
$this->router->fetch_directory(); // 目录
$this->router->fetch_class(); // 控制器
$this->router->fetch_method(); // 动作
 
复制代码

自己做一下判断就行了

本版积分规则