code igniter模块扩展 - 对MX_Router :: _ set_default_controller()的访问级别必须是public的(如在类CI_Router中) [英] code igniter Modular Extensions - Access level to MX_Router::_set_default_controller() must be public (as in class CI_Router)

查看:219
本文介绍了code igniter模块扩展 - 对MX_Router :: _ set_default_controller()的访问级别必须是public的(如在类CI_Router中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到流行的模块化扩展 - HMVC从

安装

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc



并使用codeigniter 2.2设置.2 当一切都正常工作时,我收到此错误


访问级别MX_Router :: _ set_default_controller ()在第241行上的C:.. \application\third_party\MX\Router.php中



解决方案

解决方案1 ​​



我必须在Router.php中更改几个方法的可见性,从 protected 的方法将其修复

  _set_default_controller()
_set_request()
_set_default_controller()

它几乎工作,但现在我得到一个警告以上熟悉的欢迎来到CodeIgniter消息

 消息:Undefined属性:MY_Router :: $ translate_uri_dashes 

所以我把这个属性包裹在一个if不为空,绕过这个属性

  if(!empty($ this-> translate_uri_dashes))
{
if this-> translate_uri_dashes === TRUE)
{
foreach(range(0,2)as $ v)
{
isset($ segments [$ v])& ;& $ segments [$ v] = str_replace(' - ','_',$ segments [$ v]);
}
}
}

/ p>




解决方案2



有一个现成的HMVC-ci可以从

下载

http://lab.clearpixel.com.au/2011/10/modularise-your-codeigniter-2-applications-with- modular-extensions-%E2%80%93-hmvc /



但它是一个ci 2.0.3版本不是ci 2.2.2

$如果放置核心文件(MY_Loader和MY_Router)和第三方文件夹(MX),则b
$ b

解决方案3(最佳)



<从ci 2.0.3的预配置版本(上面的链接)在ci 2.2.2的相应位置内,它会工作正常。


I get the popular Modular Extensions - HMVC installed from

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc

and set it up with codeigniter 2.2.2 BUT when everything should be working fine, I get this error

Access level to MX_Router::_set_default_controller() must be public (as in class CI_Router) in C:..\application\third_party\MX\Router.php on line 241

解决方案

Solution 1

I had to change several methods visibility in Router.php , so I changed the following methods from protected to public to get it fixed

_set_default_controller()
_set_request()
_set_default_controller()

and it almost worked but now i get a warning above the familiar Welcome to CodeIgniter message

Message: Undefined property: MY_Router::$translate_uri_dashes

so I wrapped this property around an if not empty to bypass this property like so

if(!empty($this->translate_uri_dashes))
        {
            if ($this->translate_uri_dashes === TRUE)
            {
                foreach(range(0, 2) as $v)
                {
                    isset($segments[$v]) && $segments[$v] = str_replace('-', '_', $segments[$v]);
                }
            }
        }

and now it works!


Solution 2

there is a ready HMVC-ci that can be downloaded from

http://lab.clearpixel.com.au/2011/10/modularise-your-codeigniter-2-applications-with-modular-extensions-%E2%80%93-hmvc/

but it's a ci 2.0.3 version not ci 2.2.2

Solution 3 (best)

if you place the core files (MY_Loader and MY_Router) and the third-party folder (MX) from the preconfigured version of ci 2.0.3 (link above) inside the corresponding locations in the ci 2.2.2 it will work just fine.

这篇关于code igniter模块扩展 - 对MX_Router :: _ set_default_controller()的访问级别必须是public的(如在类CI_Router中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆