使用PHP动态捕获服务器错误

my answer is quite simple: Is there a way to catch server-errors (like Error 400, 401, 403, 404, 500...) automatically with PHP and generate custom Error-Pages.

For example, let's say I got a PHP-File with the page and it just inserts the Error-Code and the Error-Message.

Thanks in advance!

You may use custom exception handler function (set_exception_handler()) and error handler (set_error_handler()) for turn errors to Exception (example)

ErrorDocument 404 /404.html

404 here is your error code and /404.html is your redirection file when error occurs. here goes your tutorial.. http://www.totallyphp.co.uk/custom-error-pages-using-htaccess