You are here: Re: how to catch the execption of DOMDocument::load() « PHP Programming Language « IT news, forums, messages
Re: how to catch the execption of DOMDocument::load()

Posted by sunnyboyGuo on 01/09/08 12:30

On Jan 9, 6:16 pm, Janwillem Borleffs <j...@jwscripts.com> wrote:
> sunnyboy...@gmail.com schreef:
>
> > How can I catch this exception and use header function to write header
> > information?
>
> Which PHP version are you using? With PHP5 you can use try/catch:
>
> try {
>    // do what you want to do} catch (Exception $ex) {
>
>    Header("http/1.1 500 Internal Server Error");
>
> }
>
> With PHP4, when the error is non-fatal, you can surpress the error
> message by prepending an at sign (@) before the functional call.
>
> JW

sorry, my environment is php5.0.

when there occured some error, it will send headers automatically, so
i can not use header() to send expected header information.
it will prompt message like this:
<br />
<b>Warning</b>: Cannot modify header information - headers already
sent by (output started at /var/www/tpms.php:155) in <b>/var/www/
tpms.php</b> on line <b>25</b><br />

can i control it not send automatically, and to send myself header
information?

best regards,
Tony

 

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

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