我使用admin-ajax在我的插件中進行ajax調用。所以,當出現錯誤時,我收到錯誤「內部服務器錯誤」,未顯示錯誤。我無法看到日誌,因爲我沒有訪問服務器?我試過像這樣:wordpress plugin admin ajax - 打印內部服務器錯誤的錯誤
try{
$req = new WP_Http;
//$headers = array('Transfer-Encoding'=> 'chunked');
$res = $req->request("url", array('method' => "POST", 'body' => $data));
//Getting error at this line when size of $daya is more than 10MB. Till 10MB, it is sending post data successfully.
//After 10MB(approx), getting Internal server error.
//But cant just think this is server restriction to max post data, as phpinfo saying that max_post_size as 64MB
}
catch(Exception $e){
echo $e;
}
但它仍然返回錯誤而沒有返回結果。我知道錯誤發生的路線,但想知道錯誤是什麼。
你可以嘗試在你的wp-config.php中將'WP_DEBUG'設置爲'true'嗎?通常會顯示致命錯誤。 –
我可以使用wordpress儀表板進行編輯嗎? – user1767962
不幸的是,你可以嘗試添加'error_reporting(E_ALL); ini_set('display_errors',1);'你的functions.php,看看是否有效。 –