Replacement for PHP's __autoload function?

后端 未结 6 1879
攒了一身酷
攒了一身酷 2021-01-05 08:36

I have read about dynamically loading your class files when needed in a function like this:

function __autoload($className)
{
   include(\"classes/$className         


        
6条回答
  •  青春惊慌失措
    2021-01-05 09:35

    Use spl_autoload_register instead of __autoload. This will allow you to add your autoload function into the stack.

提交回复
热议问题