-
PHP配置文件中與錯誤相關選項查看全部
-
<?php header('Content-type:text/html;charset=utf-8'); class ExceptionRedirectHandler{ protected $_exception; protected $_logFile = 'G:/error/redirect.log'; public $redirect='404.html'; public function __construct(Exception $e){ $this->_exception=$e; } public static function handle(Exception $e){ $self=new self($e); $self->log(); // ob_end_clean()清除所有的輸出緩沖,最后沒有緩存的時候會產生通知級別的錯誤 while(@ob_end_clean()); header('HTTP/1.1 307 Temporary Redirect'); //臨時重定向 header('Cache-Control:no-cache,must-revalidate');//no-cache強制向源服務器再次驗證,must-revalidate可緩存但必須再向源服務器進行確認 header('Expires: Sat, 28 Mar 2016 13:28:48 GMT'); //資源失效的時間 header('Location:'.$self->redirect); //跳轉 } public function log(){ error_log($this->_exception->getMessage().PHP_EOL,3,$this->_logFile); } } set_exception_handler(array('ExceptionRedirectHandler','handle')); $link=@mysql_connect('127.0.0.1','root','1234561'); if(!$link){ throw new Exception('數(shù)據(jù)庫連接出錯啦'); }查看全部
-
display_errors 在運行腳本時顯示錯誤 on顯示 off 關閉查看全部
-
parse error 語法錯誤查看全部
-
保存錯誤日志查看全部
-
trigger_error查看全部
-
錯誤語句前加@ 抑制錯誤輸出查看全部
-
error_reporting(); ini_set(error_reporting);查看全部
-
路徑為絕對路徑查看全部
-
error redirection查看全部
-
我使用的是qq郵箱作為我的接受郵箱 從http://glob.com.au/sendmail/下載sendmail.zip 2.解壓到C:下,例如C:\PHP\sendmail 在php_ini中 找到SMTP=smtp.qq.com 找到smtp_port選項 設置為smtp_port=465(因為qq郵箱需要額外開啟支持smtp,要 另外設置一個新的密碼,且端口號為465) 找到sendmail_from選項,sendmail_from=qq郵箱地址 sendmail_path="C:\PHP\sendmail\sendmail.exe -t" 在C:\PHP\sendmail中找到sendmail.ini 打開 配置SMTP=smtp.qq.com smtp_port=465 auth_username=你的qq郵箱地址 auth_password=你的qq郵箱密碼 寫完之后 創(chuàng)建一個test.php文件 寫入測試代碼 <!doctype html> <meta content-type="text/html" charset="utf8"> <?php if(mail("郵箱地址","測試","測試郵件")) { echo"發(fā)送成功!"; } else{ echo"發(fā)送失敗"; } ?> 看一看是否輸出"發(fā)送成功" 注意:qq郵箱是要在設置那里額外設置支持smtp服務的!查看全部
-
error hierarchy查看全部
-
error type查看全部
-
error handler查看全部
-
另外還可以通過@符號抑制錯誤輸出 E_ALL&~E_NOTICE 設置顯示所有級別的錯誤但是除去NOTICE錯誤查看全部
舉報
0/150
提交
取消