Home > Backend Development > PHP Tutorial > laravel中的Facades和Ioc Container怎么理解?

laravel中的Facades和Ioc Container怎么理解?

WBOY
Release: 2016-06-06 20:40:25
Original
1049 people have browsed it

Facades和Ioc Container怎么理解?我看了官方的手册还是理解不了啊,这个东西到底有什么用?

回复内容:

Facades和Ioc Container怎么理解?我看了官方的手册还是理解不了啊,这个东西到底有什么用?

facades是一种设计模式,关于Ioc Container我写了一篇文章在这里,http://segmentfault.com/blog/zhaoyi/1190000002411255

IOC 容器在laravel 里就是用来解析类的实例的。为什么要解析呢,因为类有依赖关系。
类绑定Ioc容器后,就可以用依赖注入的方式来方便获得实例。

Facade是一种更简单的解析容器实例方法,它的性质和Type-Hint注入一样,只不过更方便。

关于容器:http://laravelbase.com/collections/1/47
关于Facade:http://laravelbase.com/collections/1/49

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template