The static method
loads a PHP file and then checks for the existence of the class.
Example 530. Example of the loadClass() Method
The string specifying the class is converted to a relative path by substituting underscores with directory separators for your OS, and appending '.php'. In the example above, 'Container_Tree' becomes 'Container\\Tree.php' on Windows.
$dirs is a string or an array,
Zend_Loader::loadClass() searches the directories in
the order supplied. The first matching file is loaded. If the file
does not exist in the specified
$dirs, then the
include_path for the PHP environment is
If the file is not found or the class does not exist after the load,
Zend_Loader::loadClass() throws a
Zend_Loader::loadFile() is used for loading, so the
class name may only contain alphanumeric characters and the hyphen
('-'), underscore ('_'), and period ('.').
Loading Classes from PHP Namespaces
Starting in version 1.10.0, Zend Framework now allows loading classes from PHP namespaces. This support follows the same guidelines and implementation as that found in the PHP Framework Interop Group PSR-0 reference implementation.
Under this guideline, the following rules apply:
Each namespace separator is converted to a
DIRECTORY_SEPARATORwhen loading from the file system.
Each "_" character in the CLASS NAME is converted to a
DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
The fully-qualified namespace and class is suffixed with ".php" when loading from the file system.