autoload and multiple directories

前端 未结 6 1613
醉酒成梦
醉酒成梦 2020-12-14 21:36

I\'ve just been looking at php\'s autoload() function. Seems a nice idea, but I\'m not sure how it handles multiple directories. My current development basically has a libra

6条回答
  •  自闭症患者
    2020-12-14 21:51

    You seem confused :) Or maybe I am confused by your question.

    It is completely up to you to write a function that locates and loads the class, PHP does not care where/how many levels deep it is.

    And, look into SPL autoload too, it has the same base functionality, but you can write multiple autoload functions and then chain them. Can be useful, if you want to use some external libraries, that define their own autoloaders that could possibly conflict with yours.

提交回复
热议问题