BaseYii autoload()

autoload() public static method

Class autoload loader.

This method is invoked automatically when PHP sees an unknown class. The method will attempt to include the class file according to the following procedure:

  1. Search in $classMap;
  2. If the class is namespaced (e.g. yii\base\Component), it will attempt to include the file associated with the corresponding path alias (e.g. @yii/base/Component.php);

This autoloader allows loading classes that follow the PSR-4 standard and have its top-level namespace or sub-namespaces defined as path aliases.

Example: When aliases @yii and @yii/bootstrap are defined, classes in the yii\bootstrap namespace will be loaded using the @yii/bootstrap alias which points to the directory where bootstrap extension files are installed and all classes from other yii namespaces will be loaded from the yii framework directory.

Also the guide section on autoloading.

public static void autoload ( $className )
$className string

The fully qualified class name without a leading backslash "\"

throws yii\base\UnknownClassException

if the class does not exist in the class file

doc_Yii
2016-10-30 16:50:26
Comments
Leave a Comment

Please login to continue.