Home  >  Q&A  >  body text

php - 如何理解 service locator 和 dependence inject

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

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

巴扎黑巴扎黑2654 days ago287

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-10 17:09:18

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

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

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

    reply
    0
  • Cancelreply