Usage of Spl_autoload_register ():
Where $this represents the current class, AutoLoad () is my registered auto-load function, of course, this is just a function name, as long as it does not duplicate the PHP keyword, according to the general function name of the naming convention.
With automatic loading, when we need to load many other class files in a class, we don't have to use the Require () function frequently, so that the code looks more canonical and there is a significant improvement in performance that requires a look at the PHP kernel.
PHP relies on the Zend Engine parser, the Spl__autoload stack exists in the Zend engine, and when you use Spl_autoload_register () to register a function as an auto-load function, the function in the stack is activated. Even if the function name used in your program is __autoload (the method with __ in PHP is the Magic method), it must also be registered with the __autoload stack using the Spl_autoload_register () function display. Because Spl_autoload_register () replaces the __autoload function in Zend engine with spl_autoload () or Spl_autoload_call (). Whenever you instantiate a nonexistent class, SPL autoload by pointing the function pointer autoload_func to the function you implemented with the auto-mount function. SPL has two different function spl_autoload, Spl_autoload_call, to implement different automatic loading mechanisms by pointing autoload_func to these two different function addresses. Will trigger this function to load the corresponding class file, so as to achieve an ' automation ' effect, the world is in the pursuit of automation, the program is no exception.
PHP spl_autoload_register () function