2012-07-07 46 views
0

file.php加載500.shtml頁面時存在誤差

<?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

你有語法錯誤... – KingCrunch 2012-07-07 00:12:18

+2

我知道我有語法錯誤! – 2012-07-07 00:14:04

+0

聆聽king ... chrome用戶將會收到chrome錯誤頁面....除非您捕捉到所有異常並顯示您自己的...提示...'try {} catch(exception){}' – rlemon 2012-07-07 00:20:59

回答

-1

如果什麼?

if() 

這應該是這樣的:

if(isset($_POST)) 

和失蹤情況的鉤結束,所以最終代碼:

<?php 

ini_set('display_errors', 0); 

if(isset($_POST)){ 
echo 'test'; 
} 

?> 
+1

我犯了一個語法錯誤,只是爲了檢查它是否會顯示500.shtml頁面:) – 2012-07-07 00:15:15

+0

你想自定義你的錯誤頁面?創建.htaccess並添加: 'ErrorDocument 500/errors/500.html' 創建文件夾錯誤/並將文件500.html – Julien 2012-07-07 00:21:03

1

瀏覽器總是顯示它是自己的頁面5XX-錯誤。