codeigniter 代码点火器3 HMVC已损坏

cnwbcb6i  于 2022-12-07  发布在  其他
关注(0)|答案(5)|浏览(174)

在Codeigniter中使用此HMVC插件。(https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/src/codeigniter-3.x/
在另一个服务器上运行良好,但在这个服务器上我得到这个错误!

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: MX/Router.php

Line Number: 239

Backtrace:

File: /var/www/project.test/public/application/third_party/MX/Router.php
Line: 239
Function: strpos

File: /var/www/project.test/public/application/third_party/MX/Router.php
Line: 101
Function: _set_default_controller

File: /var/www/project.test/public/index.php
Line: 324
Function: require_once
rt4zxlrg

rt4zxlrg1#

我将函数set_class上的代码行更改为:

{
        //this is the original codes I commented
    /* $suffix = $this->config->item('controller_suffix');
        if (strpos($class, $suffix) === FALSE)
        {
            $class .= $suffix;
        }
        parent::set_class($class); 
    */

      //and change with this one
        $suffix = (string) $this->config->item('controller_suffix');
        if ($suffix && strpos($class, $suffix) === FALSE) {
            $class .= $suffix;
        }

        parent::set_class($class);
    }

Source: https://forum.codeigniter.com/thread-72393.html
but5z9lq

but5z9lq2#

只需更新Router.php中的函数文件路径:application\third_party\MX\Router.php

public function set_class($class)
    {
    //  $suffix = $this->config->item('controller_suffix');
    //  if (strpos($class, $suffix) === FALSE)

    $suffix = (string) $this->config->item('controller_suffix');
    if ($suffix && strpos($class, $suffix) === FALSE)
    {
        $class .= $suffix;
    }
    parent::set_class($class);
}

在此之后,它工作正常!

qojgxg4l

qojgxg4l4#

将其更改为:

if (strpos($class, chr($suffix)) === FALSE)
z0qdvdin

z0qdvdin5#

此链接不起作用。它显示“未找到存储库”。

相关问题