鍍金池/ 問答/PHP/ ThinkPHP某個(gè)Controlller調(diào)用公共function的方法導(dǎo)致50

ThinkPHP某個(gè)Controlller調(diào)用公共function的方法導(dǎo)致500(Internal Server Error)

thinkphp3.2.3版本。
我在項(xiàng)目中新增了一個(gè)SupportController,其中有個(gè)方法如下

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

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

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

請(qǐng)問是什么原因???

回答
編輯回答
糖豆豆

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

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>你的代碼出錯(cuò)了:</font></br>';  
        echo '致命錯(cuò)誤:' . $_error['message'] . '</br>';  
        echo '文件:' . $_error['file'] . '</br>';  
        echo '在第' . $_error['line'] . '行</br>';  
    }  
}  
   
register_shutdown_function("cache_shutdown_error");  
2017年8月10日 05:20