- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我的 codeigniter 网站在 php5.4 版本中运行正常,但是当我将我的 php 版本升级到 php5.6.30 时,它无法正常工作。
function &get_instance()
{
return CI_Controller::get_instance();
}
以上函数位于我文件的第 233 行,它返回空值。
错误 - fatal error :在第 233 行的 Coginiter_site\system\core\CodeIgniter.php 中找不到类“CI_Controller”
我已经追踪到错误点 -system/core/common.php
下的代码if ( ! function_exists('load_class'))
{
function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
static $_classes = array();
// Does the class exist? If so, we're done...
if (isset($_classes[$class]))
{
return $_classes[$class];
}
$name = FALSE;
// Look for the class first in the local application/libraries folder
// then in the native system/libraries folder
foreach (array(APPPATH, BASEPATH) as $path)
{
if (file_exists($path.$directory.'/'.$class.'.php'))
{
$name = $prefix.$class;
if (class_exists($name) === FALSE)
{
require($path.$directory.'/'.$class.'.php');
}
break;
}
}
// Is the request a class extension? If so we load it too
if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'))
{
$name = config_item('subclass_prefix').$class;
if (class_exists($name) === FALSE)
{
require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php');
}
}
// Did we find the class?
if ($name === FALSE)
{
// Note: We use exit() rather then show_error() in order to avoid a
// self-referencing loop with the Excptions class
exit('Unable to locate the specified class: '.$class.'.php');
}
// Keep track of what we just loaded
is_loaded($class);
$_classes[$class] = new $name();
return $_classes[$class];
}
}
返回空结果这行创建一个问题 $_classes[$class] = new $name();请检查。
最佳答案
能不能请你关注第一个solution这个的?希望它能解决您的问题。
关于php - CodeIgniter &get_instance() 在 php5.6 版本中不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44241250/
在典型的单例中,构造函数在第一次调用 getInstance() 时被调用。我需要的是将 init 和 getInstance 函数分开。 init 函数必须创建实例 using constructo
浏览codeigniter的源码, 在它的辅助函数中,我不断看到代码$CI =& get_instance();谁能给我解释一下这段代码是如何工作的? 我知道它正在返回对 $CI super 对象的引
在 PHPStorm 中,通过向 config/autocomplete.php 添加一个包含属性的文件,我已经能够使用 Codeigniter 获得自动完成功能。 PhpStorm 能够读取此文件,
我发现这个有用的国际化代码: http://pastebin.com/SyKmPYTX 一切正常,除了我无法在此类中使用 CI 函数。 我想从 DB 设置 $languages 和 $special
这是我在 codeigniter 库文件夹中的自定义类 class Commonlib { public function __construct() {
我有一些功能可以管理 Controller 文件中某个 Controller 的访问级别。 我决定带他们去图书馆或 helper 。 由于它们主要是程序性的,我决定使用助手。 这是 Controlle
在 Codeigniter 中,get_instance()是一个全局可用的函数,它返回包含所有当前加载的类的 Controller 超对象(它返回 Controller 类实例)。我将包含当前的源代
我在/application/core 中有一个 Controller /application/core/CMS_Controller.php load->view('view'); } }
我的 codeigniter 网站在 php5.4 版本中运行正常,但是当我将我的 php 版本升级到 php5.6.30 时,它无法正常工作。 function &get_instance() {
我目前正在使用 Eclipse PDT 和 CodeIgniter,是否可以像这样获得 session 库的代码完成: $CI = &get_instance(); $CI->session->se
在下面的这个虚拟示例中,我想创建一个单例,我可以在其中保存在嵌入式微 Controller 上成本很高的 get_instance 调用。 #include template class Camel
我的 WordPress 网站出现 fatal error ,详情如下: Fatal error: Uncaught Error: Call to undefined method WP_Site_H
我是一名优秀的程序员,十分优秀!