鍍金池/ 問答/PHP/ ThinkPHP某個Controlller調用公共function的方法導致50

ThinkPHP某個Controlller調用公共function的方法導致500(Internal Server Error)

thinkphp3.2.3版本。
我在項目中新增了一個SupportController,其中有個方法如下

    public function index(){         
        $url="http://www.baidu.com";
        var_dump(check_remote_url($img_qiniu)); //check_remote_url是common/function中的方法
        //如果把上面這行注釋就不會報錯500 (Internal Server Error)
    }

check_remote_url是公共函數(shù)common/function中的方法,只要一使用就報錯500 (Internal Server Error),注釋掉又好了。
不光是這個check_remote_url,只要這個新增的控制器使用公共函數(shù)中的方法都報錯。

補充:最詭異的是,在我沒新增之前,項目本身有個TestController,其中也有使用公共函數(shù)common/function中的方法,但是沒有任何問題。

請問是什么原因???

回答
編輯回答
糖豆豆

原因當然是 common 下的某個文件有錯誤,500 如果頁面空白的話,需要打開php的錯誤提示?;蛘咴趇ndex.php中加入以下代碼,就能看到錯誤信息

error_reporting(E_ALL); //E_ALL  
   
function cache_shutdown_error() {  
   
    $_error = error_get_last();  
   
    if ($_error && in_array($_error['type'], array(1, 4, 16, 64, 256, 4096, E_ALL))) {  
   
        echo '<font color=red>你的代碼出錯了:</font></br>';  
        echo '致命錯誤:' . $_error['message'] . '</br>';  
        echo '文件:' . $_error['file'] . '</br>';  
        echo '在第' . $_error['line'] . '行</br>';  
    }  
}  
   
register_shutdown_function("cache_shutdown_error");  
2017年8月10日 05:20