将PHP更新为PHP 7后,CodeIgniter HMVC错误

将5.6更新为PHP 7.
我正在使用Code Igniter的HMVC实现,并且PHP升级开始引发以下错误: - </ p>


  1. 遇到PHP错误严重性:警告</ p>

    消息:MX_Loader :: library的声明($ library ,$ params = NULL,
    $ object_name = NULL)应该与

    NCI_Loader :: library兼容($ library ='',$ params = NULL,$ object_name =
    NULL)</ p>

    文件名:MX / Loader.php </ p>

    行号:143 </ p> </ li>

  2. 遇到PHP错误严重性:警告</ p >

    消息:MX_Loader :: helper($ helper)的声明应与CI_Loader :: helper($ helpers = Array)不兼容</ p>

    文件名:MX / Loader.php </ p>

    行号:0 </ p> </ li>

  3. 遇到PHP错误严重性:警告</ p>

    消息:MX_Loader :: helpers($ helpers)的声明应与CI_Loader :: helpers($ helpers = Array)不兼容</ p>

    文件名:MX / Loader.php </ p>

    行号: 0 </ p> </ li>

  4. 遇到PHP错误严重性:警告</ p>

    消息:MX_Loader :: language的声明($ langfile,$ lang ='',
    $ return = false)应与CI_Loader :: language兼容($ file
    = Array,$ lang ='')</ p>

    文件名:MX / Loader。 php </ p>

    行号:0 </ p> </ li>

  5. 遇到PHP错误严重性:警告</ p>

    消息:MX_Loader :: _ ci_get_component($ component)
    的声明应该与&amp; CI_Loader :: _ ci_get_component($ component)</ p>

    文件名:MX / Loader.php </ p>

    行号:0 </ p> </ li> \ n

  6. 遇到PHP错误严重性:警告</ p>

    消息:声明MX_Lang :: load($ langfile,$ lang ='',$ return
    = false ,$ _module = NULL)应该与CI_Lang :: load兼容($ langfile ='',$ idiom ='',$ return = false,
    $ add_suffix = true,$ alt_path ='')</ p> \ n

    文件名:MX / Lang.php </ p>

    行号:70 </ p> </ li>

  7. 遇到PHP错误严重性 :注意</ p>

    消息:只应通过引用分配变量</ p>

    文件名:core / Loader.php </ p>

    行号:257 </ p> </ li>
    </ ol>
    </ div>

展开原文

原文

After updating 5.6 to PHP 7. I was using HMVC implementation of Code Igniter and PHP upgrade started throwing following errors:-

  1. A PHP Error was encountered Severity: Warning

    Message: Declaration of MX_Loader::library($library, $params = NULL, $object_name = NULL) should be compatible with CI_Loader::library($library = '', $params = NULL, $object_name = NULL)

    Filename: MX/Loader.php

    Line Number: 143

  2. A PHP Error was encountered Severity: Warning

    Message: Declaration of MX_Loader::helper($helper) should be compatible with CI_Loader::helper($helpers = Array)

    Filename: MX/Loader.php

    Line Number: 0

  3. A PHP Error was encountered Severity: Warning

    Message: Declaration of MX_Loader::helpers($helpers) should be compatible with CI_Loader::helpers($helpers = Array)

    Filename: MX/Loader.php

    Line Number: 0

  4. A PHP Error was encountered Severity: Warning

    Message: Declaration of MX_Loader::language($langfile, $lang = '', $return = false) should be compatible with CI_Loader::language($file = Array, $lang = '')

    Filename: MX/Loader.php

    Line Number: 0

  5. A PHP Error was encountered Severity: Warning

    Message: Declaration of MX_Loader::_ci_get_component($component) should be compatible with & CI_Loader::_ci_get_component($component)

    Filename: MX/Loader.php

    Line Number: 0

  6. A PHP Error was encountered Severity: Warning

    Message: Declaration of MX_Lang::load($langfile, $lang = '', $return = false, $_module = NULL) should be compatible with CI_Lang::load($langfile = '', $idiom = '', $return = false, $add_suffix = true, $alt_path = '')

    Filename: MX/Lang.php

    Line Number: 70

  7. A PHP Error was encountered Severity: Notice

    Message: Only variables should be assigned by reference

    Filename: core/Loader.php

    Line Number: 257

douzi0609
douzi0609 感谢您的建议,对不起,这是我现有的项目,所以现在我无法更新ci版本,但我已经修复了我的所有问题。
3 年多之前 回复
doudaochu1699
doudaochu1699 CI2.2.6与PHP7与hmvcafaik不兼容,您需要升级到CI3并安装wiredesignz的最新更新(bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/...)
3 年多之前 回复
dsyk33753
dsyk33753 codeigniter2.2.6
3 年多之前 回复
donglang8008
donglang8008 您是哪个版本的CI?
3 年多之前 回复

2个回答



我修复了所有问题。 我给出了Bellow:</ p>

  1.third_party \ MX \ Lang.php 
line = 134
公共函数库($ library ='',$ params = NULL, $ object_name = NULL)

2.第三方\ MX \ Loder.php
line = 105
pulic function helper($ helper = array())

3.第三方\ MX \ Loder。 php
line = 120
pulic function helper($ helper = array())

4.第三方\ MX \ Loder.php
line = 124
公共函数语言($ langfile = array (),$ idiom ='',$ return = FALSE,$ add_suffix = TRUE,$ alt_path ='')

5.第三方\ MX \ Loder.php
line = 271
公共功能&amp; _ci_get_component($ component)

6.第三方\ MX \ Lang.php
line = 70
公共函数加载($ langfile ='',$ lang ='',$ return = FALSE,$ add_suffix = TRUE,$ alt_path ='',$ _module ='')

7.system / core / commopn.php
line = 257
$ _config [0] =&amp; $ config;
返回$ _config [0];
</ code> </ pre>
</ div>

展开原文

原文

I have fixed all issue. Bellow I have given:

 1.third_party\MX\Lang.php
    line = 134
    public function library($library = '', $params = NULL, $object_name = NULL) 

    2.third party\MX\Loder.php
     line=105
     pulic function helper($helper = array())

    3.third party\MX\Loder.php
     line=120
     pulic function helper($helper = array())


    4.third party\MX\Loder.php
     line=124
    public function language($langfile=array(), $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '') 

    5.third party\MX\Loder.php
     line=271
    public function  &_ci_get_component($component)


    6.third party\MX\Lang.php
     line=70
    public function load($langfile ='', $lang = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '', $_module = '')


    7.system/core/commopn.php
     line=257
         $_config[0] =& $config;
           return $_config[0];



您可以阅读错误的描述,它说MX_Loader类中的某些函数不兼容。 它与父类不兼容。</ p>

我的MX类扩展了CI_Loader,这是CI核心加载器。
只需在错误消息中找到提到的函数并在Core中找到它 装载机。 您可以在system / core / loader.php中找到它</ p>

例如,错误号1有库函数错误。 只需在核心加载器中找到“库”函数,并将函数内的参数复制到MX加载器中库函数的参数。
等等</ p>
</ div>

展开原文

原文

You can read the description of your error, it said that some functions in MX_Loader class is not compatible. It is not compatible with the parent class.

My MX Class extends CI_Loader, which is the CI Core loader. So just find the mentioned function in the error message and find it in the Core Loader. You can find it in system/core/loader.php

For example, the error number 1 has library function error. Just find "library" function in core loader and copy the parameter inside the function to the parameter of the library function in your MX loader. And so on

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐