私のcodeigniterサイトはphp5.4バージョンで正しく動作していますが、私のphpバージョンをphp5.6.30にアップグレードすると動作しません。CodeIgniterとget_instance()はphp5.6バージョンで動作していませんか?
function &get_instance()
{
return CI_Controller::get_instance();
}
上記の関数は、ファイルの233行にあり、null値を返しています。
エラー - 致命的なエラー:クラスのCI_Controller「Coginiter_site \システム\コアには見られない\ CodeIgniter.phpライン233
上の私は、エラー箇所をトレースしている - コードをシステム/コアの下で/ 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 [$クラス]をcreateingこの行は、新しい$名=(); ご確認ください。
[CodeIgniter:Class 'CI \ _Controller'が見つかりません](https://stackoverflow.com/questions/6758681/codeigniter-class-ci-controller-not-found) – MrSanchez
私はあなたのシステムファイルの問題と思う私はこの関数を361行に持っていますので、最初にあなたのフォルダをバックアップし、新しいcodeigniterをダウンロードしてシステムフォルダを置き換えてください。 – ImBS
&get_instance()関数を使用するコードを入れてください。 – ImBS