2017-05-29 12 views
3

私の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この行は、新しい$名=(); ご確認ください。

+0

[CodeIgniter:Class 'CI \ _Controller'が見つかりません](https://stackoverflow.com/questions/6758681/codeigniter-class-ci-controller-not-found) – MrSanchez

+0

私はあなたのシステムファイルの問題と思う私はこの関数を361行に持っていますので、最初にあなたのフォルダをバックアップし、新しいcodeigniterをダウンロードしてシステムフォルダを置き換えてください。 – ImBS

+0

&get_instance()関数を使用するコードを入れてください。 – ImBS

答えて

1

あなたは、thisCodeIgniter.phpライン上の変更を試みることができる75

set_error_handler('_exception_handler'); 

set_exception_handler('_exception_handler'); 

更新:これはあなたが多分、

に動作しない場合これ以外のものを確認できます:

DBエラーの場合は
  1. チェック(それは奇妙だが、時にはDBエラー は悪いデシベル 名で、例えば、「CI_Controllerが見つからない」として示されています)。
  2. 変更を確認する:$config['log_threshold'] = 0;
  3. CIフレームワークシステムフォルダ全体を再インストールします。

Herehereに同じ問題がある場合は、すべての回答を確認できます。

これらのいずれも動作しない場合は、コントローラにコードとコンテキストを投稿してみてください。

希望すると助かります!

+0

はい私はこのことを私に明確にしました。(&get_instance();)はnullになります...コアフォルダのファイル名の下にMY_Controller.phpがあります –

+0

いいえ、私のために働いていません... –

2

この最初のsolutionに従ってください。あなたの問題を解決することを願っています。

+0

私の問題はビューの読み込みに関連していません.........はい "致命的なエラー:クラス 'CI_Controller'がパス231 \" \ system \ core \ CodeIgniter.phpの行231に見つかりません ".. ...私もこのソリューションを行った.......しかし、私は$ ci =&get_instance()と思う;ここではまだヌルです。 –

関連する問題