Home > Article > Backend Development > PHP autoload implements automatic loading of classes_PHP tutorial
The autoload mechanism makes it possible for PHP programs to automatically include class files only when classes are used, instead of including all class files from the beginning. This mechanism is also called lazy loading.
The following is an example of using the autoload mechanism to load the Person class:
The code is as follows
|
Copy code
|
||||||||
/* autoload.php */
Implementation of PHP’s autoload mechanism
|
The code is as follows | Copy code
|