首页 > 如何理解 service locator 和 dependence inject

如何理解 service locator 和 dependence inject

暂时的理解是 (也不知道是不是这样):
di 就是用 反射实现的 ioc
service locator 就是结合了注册器模式和工厂模式(带记忆功能的工厂模式)

尽量用 PHP 的小例子说明, 感谢了


https://github.com/domnikl/DesignPatternsPHP/tree/master/More

每天看一遍,直到恍然大悟。

学习设计模式是一个漫长的过程 《PHP设计模式》

【热门文章】
【热门文章】