note 54079 added to function.include
| From: | danny at nettaxi dot com | Date: | Thu, 23 Jun 2005 09:07:59 +0000 |
| Subject: | note 54079 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90823@lists.php.net to get a copy of this message | ||
[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.
?>
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54079
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54079&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54079&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54079&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54079&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54079&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54079&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54079&report=yes
Search -- http://master.php.net/manage/user-notes.php