note 25581 deleted from function.include by sniper
| From: | sniper@php.net | Date: | Wed, 29 Jan 2003 04:14:46 +0000 |
| Subject: | note 25581 deleted from function.include by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42992@lists.php.net to get a copy of this message | ||
I just wanted to add a quick note about including a file that doesn't exist and then displaying
a 404 message. Here's the code I used:
<?if(!@include("$page.php")){include("404.php");}?>
This is quick, simple and one line that you can slam anywhere. Similar to a previous post, just puts
the initial include as the condition of the if, thus saving the need of another variable. If include
returns anything, the page will be displayed. I found this interesting :)