You are here: Re: Custom error handling in php e.g. 404 not found « All PHP « IT news, forums, messages
Re: Custom error handling in php e.g. 404 not found

Posted by on 02/13/06 04:44

Found the example in the magazine:
---
<?php error_reporting (E_ERROR | E_WARNING | E_NOTICE);
$reportMail = 'you@youremail.com';
$redirectPage = 'http://www.yourdomain.com/error.htm'
function pageError($errno, $errstr, $errfile='?', $errline= '?') {
global $reportMail, $redirectPage;
if (($errno & error_reporting()) == 0)
return;
$err = ' ';
switch($errno) {
case E_ERROR: $err = 'FATAL'; break;
case E_WARNING: $err = 'ERROR'; break;
case E_NOTICE: return;
}
mail($reportMail, "PHP Error: $errfile' $errline",
"$errfile, Line $errline\n$err($errno)\n$errstr");
print '<META HTTP-EQUIV="Refresh" CONTENT="0;url=' .$redirectPage.
'">';
die();
}
set_error_handler('pageError');
?>
---

Then has a further little bit of info:
---
<?php
require('errorphp.php');
print 2/0;
?>
---

Does this example mean I can use my own custom error pages e.g. 404?

As I only had a short time, I didn't get the jist of the whole article
and so am asking for help.
Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация