我正在尝试定制错误页面 - 我做错了什么?

时间:2013-08-15 02:32:24

标签: php apache xampp

我正在使用具有Apache 2.4.3的xampp。在文件xampp / apache / conf / httpd.conf中,我设置了“AllowOverride All”。在xampp / htdocs / .htaccess中,我设置了“ErrorDocument 500 /InitialError.php”。 InitialError.php是一个文件,现在只是回显一些简单的html。在我的文件xampp / htdocs / index.php中,我有一行“$ new = new unknownclass();”未知类未定义的地方。

当我运行index.php文件时,我看到的只是错误消息 “致命错误:在第3行的C:\ xampp \ htdocs \ index.php中找不到类'unknownclass'”,如果display_errors为false,我看不到任何内容。

我还需要设置其他内容吗?

1 个答案:

答案 0 :(得分:0)

你不能用htaccess做到这一点。

有些事情:

Apache:啊一个php请求,那就是php的工作

PHP:我知道了。

Apache:好的,我要回家了。

PHP:狗屎,我没有这个。

PHP的问题是返回错误页面。

如果在apache中出现问题,页面应该可以正常工作!

PS检查

http://php.net/manual/en/function.register-shutdown-function.php

http://php.net/manual/en/function.set-error-handler.php