codeigniter致命错误使用$ this不在对象上下文 [英] codeigniter fatal error using $this not in object context
问题描述
我在我的头撞到墙上。我有一个codeigniter应用程序,我正在从一个服务器迁移到另一个。当迁移时,我抛出一个错误(它不在生产中)。
I am beating my head against the wall on this. I have a codeigniter application that I am migrating from one server to another. When migrated, I throws an error (it doesn't in production).
Fatal error: Using $this when not in object context in /SYSTEM_PATH/system/database/DB.php on line 146
我已经尝试重新上传/迁移(希望它是一个损坏的文件或东西),但没有运气。
I've already tried re-uploading/migrating (hoping it was a corrupt file or something), but no luck.
推荐答案
这对于评论来说太大了:
This is too big for a comment:
你确定你下载了一个稳定的版本 - 或者你使用CI的开发版本?)
(Are you sure you downloaded a stable version - or did you use the development version of CI?)
在2.1.3行142到156看起来像下面, code> $ this 在其中
In 2.1.3 Line 142 to 156 looks like below, no mention of $this
in there
// Instantiate the DB adapter
$driver = 'CI_DB_'.$params['dbdriver'].'_driver';
$DB = new $driver($params);
if ($DB->autoinit == TRUE)
{
$DB->initialize();
}
if (isset($params['stricton']) && $params['stricton'] == TRUE)
{
$DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
}
return $DB;
请在这里查看 https://github.com/EllisLab/CodeIgniter/blob/2.1.3/system/database/DB.php
这篇关于codeigniter致命错误使用$ this不在对象上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!