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

[已解决] 关于两层控制器目录

[复制链接]
发表于 2008-5-16 23:37:26 | 显示全部楼层 |阅读模式
本帖最后由 flyy 于 2009-3-3 14:05 编辑

<a href="<?php echo base_url();?>admin/news/menue" target="left">新闻管理</a></li>
admin 一级目录 news二级目录 menue 为c  调用menue 失败!
发表于 2008-5-17 01:06:09 | 显示全部楼层
什么错误提示?
 楼主| 发表于 2008-5-17 02:06:13 | 显示全部楼层
本帖最后由 flyy 于 2009-3-3 14:15 编辑

The requested URL /admin/news/menue/index was not found on this server.
发表于 2008-5-17 02:23:12 | 显示全部楼层
你没设置 base_url 吧?
你这个提示是 CI 报告的还是服务器报告的?
 楼主| 发表于 2008-5-17 10:06:52 | 显示全部楼层
关键它怎么判断news是目录还是控制器
是不是要设置 $route 数组

[ 本帖最后由 flyy 于 2008-5-17 10:42 编辑 ]
发表于 2008-5-17 13:43:07 | 显示全部楼层
ci是不是只判断了一层目录
贴段源代码,Router.php里面的

PHP复制代码
 
        function _validate_request($segments)
        {
                // Does the requested controller exist in the root folder?
                if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
                {
                        return $segments;
                }
 
                // Is the controller in a sub-folder?
                //这里只处理一层下级目录
                if (is_dir(APPPATH.'controllers/'.$segments[0]))
                {              
                        // Set the directory and remove it from the segment array
                        $this->set_directory($segments[0]);
                        $segments = array_slice($segments, 1);
                       
                        if (count($segments) > 0)
                        {
                                // Does the requested controller exist in the sub-folder?
                                if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
                                {
                                        show_404();    
                                }
                        }
                        else
                        {
                                $this->set_class($this->default_controller);
                                $this->set_method('index');
                       
                                // Does the default controller exist in the sub-folder?
                                if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
                                {
                                        $this->directory = '';
                                        return array();
                                }
                       
                        }
                               
                        return $segments;
                }
       
                // Can't find the requested controller...
                show_404();    
        }
 
复制代码
发表于 2008-5-17 17:06:32 | 显示全部楼层
又是几周没搞CI,发现没有发言权了
 楼主| 发表于 2008-5-17 17:29:05 | 显示全部楼层
不用2层了!!
发表于 2008-5-21 01:22:42 | 显示全部楼层
CI绝对支持2层目录
发表于 2009-3-3 11:56:01 | 显示全部楼层
如何支持二层,我也想知道

本版积分规则