file.php
<?php
ini_set('display_errors', 0);
if(){
echo 'test';
?>
我想隐藏错误并显示500.shtml页面,但我看到了谷歌浏览器错误页面。
// 500.shtml
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>500 Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error</H1>
The server encountered an internal error or misconfiguration and was unable
to complete your request.<P> Please contact the server administrator and
inform them of the time the error occurred, and anything you might have
done that may have caused the error.<P> More information about this
error may be available in the server error log.<P>
</BODY></HTML>
答案 0 :(得分:1)
Chrome始终会显示5xx错误的页面。
答案 1 :(得分:1)
Internet Explorer and Chrome在收到错误页面smaller than 512 bytes的HTTP错误代码(例如500)时会显示自己的错误页面。
增加错误页面的大小,它应该开始显示在Chrome中。
答案 2 :(得分:-1)
如果有什么?!
if()
这应该是这样的:
if(isset($_POST))
并且错过了条件挂钩的结束,所以最终代码:
<?php
ini_set('display_errors', 0);
if(isset($_POST)){
echo 'test';
}
?>