2016-04-27 18 views
3

警告:register_shutdown_function():無効なシャットダウンコールバックregister_shutdown_function()を使用しているときに「シャットダウンコールバック」が無効になるのはなぜですか?

trait ErrorTrait { 

     public function shutDownFunction() { 
      $error = error_get_last(); 
       // fatal error, E_ERROR === 1 
       if ($error['type'] === E_ERROR) { 
        //do your stuff  

        $messageStore="Using $this when not in object context"; 

        if (strstr ($error['message'],$messageStore)) 

        { 
         echo "found it"; 

        } 

       } 
       } 




     public function shutdown_function() 
     { 
     register_shutdown_function('shutDownFunction'); 
     } 

}

私は私のメインクラスでこの特性を利用して、この時点で、その後

use ErrorTrait; 

    public function test() 
{ self::shutDownFunction(); 


    self::shutdown_function(); } 

それから関数を呼び出すと私テスト中の関数を「実行」と呼ばれる関数で呼び出す

私は単に関数を呼び出すだけです。

これが問題の原因となる理由はありますか?

答えて

4

呼び出し可能ではなく文字列をregister_shutdown_functionに渡しています。コールは次のようになります

register_shutdown_function([$this, 'shutDownFunction']); 
+0

ありがとうございました –

関連する問題