Chinaunix首页 | 论坛 | 博客
  • 博客访问: 26797
  • 博文数量: 12
  • 博客积分: 170
  • 博客等级: 入伍新兵
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-21 19:12
文章分类

分类: PHP

2014-01-12 16:03:02

       把CodeIgniter从1.68升级到1.73后, 当链接地址中指定d参数时,出现找不到Controller文件的错误。经跟踪查找发现CodeIgniter调用的控制器文件路径不包括指定的目录参数,对比1.68和1.73的Router.php文件,1.73的function _set_routing()中缺少对链接中d参数的处理,修正问题解决。代码如下:
    function _set_routing()
    {
        // Are query strings enabled in the config file?
        // If so, we're done since segment based URIs are not used with query strings.
        if ($this->config->item('enable_query_strings') === TRUE AND isset($_GET[$this->config->item('controller_trigger')]))
        {
            $this->set_class(trim($this->uri->_filter_uri($_GET[$this->config->item('controller_trigger')])));

            if (isset($_GET[$this->config->item('function_trigger')]))
            {
                $this->set_method(trim($this->uri->_filter_uri($_GET[$this->config->item('function_trigger')])));
            }
            
            /** 增加以下4行 **/
            if (isset($_GET[$this->config->item('directory_trigger')]))
            {
                $this->set_directory($_GET[$this->config->item('directory_trigger')]);
            }
                        
            return;
        }
        .....
    }
阅读(877) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~