gal*_*dia 5 orm codeigniter datamapper
当我将我的服务器升级到php7 codeigniter,特别是datamapper ORM给我这个错误...
消息:访问静态属性DataMapper :: $ config为非静态
文件名:libraries/datamapper.php行号:6474
有问题的功能是......
protected function _dmz_assign_libraries()
{
static $CI;
if ($CI || $CI =& get_instance())
{
// make sure these exists to not trip __get()
$this->load = NULL;
$this->config = NULL;
$this->lang = NULL;
// access to the loader
$this->load =& $CI->load;
// to the config
$this->config =& $CI->config;
// and the language class
$this->lang =& $CI->lang;
}
}
Run Code Online (Sandbox Code Playgroud)
小智 6
我也有同样的问题。要修复此问题,请尝试添加新的受保护的静态方法
protected static function get_config_object() {
$CI =& get_instance();
return $CI->config;
}
Run Code Online (Sandbox Code Playgroud)
然后删除或注释行6474和6481(在中_dmz_assign_libraries,将值分配给$this->config),
最后将所有通话替换$this->config为self::get_config_object()
现在应该可以正确运行了。