Autoload classes from different folders

前端 未结 12 977
不知归路
不知归路 2020-11-28 19:35

This is how I autoload all the classes in my controllers folder,

# auto load controller classes
    function __autoload($class_name) 
    {
             


        
12条回答
  •  暖寄归人
    2020-11-28 19:59

    __autoload() function should not be use because it is not encourged. Use spl_autoload(), spl_autoload_register() instead. __autoload() just can load one class but spl_autoload() can get more than 1 classes. And one thing more, in future __autoload() may deprecated. More stuff can be find on http://www.php.net/manual/en/function.spl-autoload.php

提交回复
热议问题