Prev | Current Page 183 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

wjgilmore.com/index.html?background=blue";
Two requirements must be satisfied before the inclusion of remote files is possible.
First, the allow_url_fopen configuration directive must be enabled. Second, the URL
wrapper must be supported. The latter requirement is discussed in further detail in
Chapter 16.
CHAPTER 3 ?–  PHP BASICS 111
Ensuring a File Is Included Only Once
The include_once() function has the same purpose as include() except that it first
verifies whether the file has already been included. Its prototype follows:
include_once (filename)
If a file has already been included, include_once() will not execute. Otherwise, it
will include the file as necessary. Other than this difference, include_once() operates
in exactly the same way as include().
The same quirk pertinent to enclosing include() within conditional statements
also applies to include_once().
Requiring a File
For the most part, require() operates like include(), including a template into the file
in which the require() call is located. Its prototype follows:
require (filename)
However, there are two important differences between require() and include().
First, the file will be included in the script in which the require() construct appears,
regardless of where require() is located. For instance, if require() is placed within an
if statement that evaluates to false, the file would be included anyway.


Pages:
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195