spl_autoload_register() syntax/structure 姓名
spl_autoload_register() syntax/structure name
我以前用过这个函数,但今天再次使用它时,我注意到了它的结构。它与 jQuery.
非常相似
spl_autoload_register(function ($class) {
// Todo
});
它看起来像依赖注入,但正在传递一个函数,所以它不会是依赖注入。有没有它的名字?
它被称为闭包或匿名函数,本质上是一个内联函数。
David Farthing 的回答
我以前用过这个函数,但今天再次使用它时,我注意到了它的结构。它与 jQuery.
非常相似spl_autoload_register(function ($class) {
// Todo
});
它看起来像依赖注入,但正在传递一个函数,所以它不会是依赖注入。有没有它的名字?
它被称为闭包或匿名函数,本质上是一个内联函数。
David Farthing 的回答