Codeigniter-无法访问以'\ 0'错误开头的属性

问题描述 投票:0回答:1

我正在codeigniter中调用函数表单库,这给了我下面的错误

PHP致命错误:在第85行的/system/core/Exceptions.php中无法访问以'\ 0'开头的属性

代码

$this->load->library('test_library');
TEST_LIBRARY::first();

Class文件

class TEST_LIBRARY
{
    public function first(){
        return "here";
    }
}

但是,当我使用此方法$this->test_library->first();调用函数时,它工作正常。

在不确定发生什么之前,它正在双向工作。 error.log文件中没有其他日志消息。如何进一步调试并解决此问题?

php codeigniter codeigniter-3
1个回答
0
投票

Function first不是静态的,但您调用时好像是静态的。试试:

$test_library = new TEST_LIBRARY();
$test_libaray->first();

而不是:TEST_LIBRARY :: first();

© www.soinside.com 2019 - 2024. All rights reserved.