PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Loading Files

The static method Zend_Loader::loadFile() loads a PHP file. The file loaded may contain any PHP code. The method is a wrapper for the PHP function include(), which emits a PHP warning on failure, for example if the specified file does not exist.

Example 529. Example of the loadFile() Method

<?php
Zend_Loader
::loadFile($filename$dirs=null$once=false);

The $filename argument specifies the filename to load, which must not contain any path information. A security check is performed on $filename. The $filename may only contain alphanumeric characters, dashes ("-"), underscores ("_"), or periods ("."). No such restriction is placed on the $dirs argument.

The $dirs argument specifies which directories to search for the file in. If the value is NULL, only the include_path is searched; if the value is a string or an array, the directory or directories specified will be searched, followed by the include_path.

The $once argument is a boolean. If TRUE, Zend_Loader::loadFile() uses the PHP function include_once() for loading the file, otherwise the PHP function include() is used.

Zend Framework