发新话题
打印

关于两层控制器目录

关于两层控制器目录


<a href="<?php echo base_url();?>admincp/news/menue" target="left">新闻管理</a></li>
调用menue 失败!
附件: 您所在的用户组无法下载或查看附件

TOP

什么错误提示?
QQ: 49489680
MSN: zhaochang_tj AT hotmail DOT com

TOP

The requested URL /admincp/news/menue/index was not found on this server.

TOP

你没设置 base_url 吧?
你这个提示是 CI 报告的还是服务器报告的?
QQ: 49489680
MSN: zhaochang_tj AT hotmail DOT com

TOP

关键它怎么判断news是目录还是控制器
是不是要设置 $route 数组

[ 本帖最后由 flyy 于 2008-5-17 10:42 编辑 ]

TOP

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();     
        }
 

TOP

又是几周没搞CI,发现没有发言权了

TOP

不用2层了!!

TOP

CI绝对支持2层目录

TOP

发新话题