note 54079 rejected from function.include by nlopess
| From: | nlopess@php.net | Date: | Thu, 23 Jun 2005 09:13:11 +0000 |
| Subject: | note 54079 rejected from function.include by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90824@lists.php.net to get a copy of this message | ||
Note Submitter: danny at nettaxi dot com
----
[Problems] : Please read the following code.
When a PHP script (a.php) include another PHP script (b.php), but the syntax of 'b.php' is
wrong. If a '@' was added in front of include line. Then the program will stop and show
nothing on the screen. The user don't know what happen.
How to make the program can display 'False' or trigger a user defined error message?
[ a.php ]
<?php
if ( @ include('b.php') ) {
echo 'Success!';
}
else {
echo 'False!';
}
?>
[ b.php ]
<?php
echo 'This is wrong syntax; // Note: missing an ending string quote.
?>