PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I make sure an include file exists before loading the page?


If it is essential that something you wish to include is there before you load a page, then don't use include, use require instead.

For instance if it is not just a stylesheet you are including but a file containing data that the page won't make sense without.

<?php
require("musthavethis.php");
//fatal error if not present
include("takeitorleaveit.html");
//if not present just an error message, script continues to run
?>



Comment on this Question and Answer >>>

ASK A QUESTION

More website PHP Questions

how to get gmail inboxmessages in php using username and password

How can I use sessions in PHP?

How to run a php script on different browsers?

What is a .htaccess file?

How do I find a visitors IP address?



Custom Search