萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> PHP通過Eamil郵件發送出錯信息

PHP通過Eamil郵件發送出錯信息

   PHP通過Eamil郵件發送出錯信息,覺得不是很常用,不過做為經常搞PHP項目,先留著自己以後參考。

  view sourceprint?01

  02//自定義處理程序

  03function nettuts_error_handler($number, $message, $file, $line, $vars){

  04 $email = "

  05

  An error ($number) occurred on line

  06 $line and in the file: $file.

  07

  $message

  ";

  08 $email .= "

  " . print_r($vars, 1) . "

  ";

  09 $headers = 'Content-type: text/html; charset=iso-8859-1' . "rn";

  10 error_log($email, 1, '[email protected]', $headers);

  11 if ( ($number !== E_NOTICE) && ($number < 2048) ) {

  12 die("有錯誤,請稍後再試!.");

  13 }

  14}

  15set_error_handler('nettuts_error_handler');

  16echo $somevarthatdoesnotexist;

  17?>

copyright © 萬盛學電腦網 all rights reserved