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

前端 未结 9 1060
一整个雨季
一整个雨季 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:01

    I know this is an old thread however...

    You could render an iframe element into your view, and then set its height and width to 100% in the event of the error you are preparing to handle.

    THAT SAID

    I truly think that the best modern solution for this would be something like:

    
    

    Error!

    This would result in a proper error code for all users, and also a stack trace for dev if you set the $env variable to 'dev' on your dev stack.

    No redirect, no hackery, secure unless you need to expose an error it won't. :)

提交回复
热议问题