Trigger 500 Internal Server Error in PHP and display Apache error page

前端 未结 9 1092
一整个雨季
一整个雨季 2020-12-25 11:30

How can i trigger 500 Internal Server Error or 404 Page Not Found Apache errors in PHP?

For 500 Internal Server Error i have tried

9条回答
  •  鱼传尺愫
    2020-12-25 12:07

    function ISE()
    {
      header('HTTP/1.1 500 Internal Server Error', true, 500);
      trigger_error('ISE function called.', E_USER_ERROR);//if you are logging errors?
    }
    

    However, you will need output buffering ON to be able to use php header() function after you use any output function like echo.

提交回复
热议问题