📜  conteneur d'injection de dépendance php 代码示例

📅  最后修改于: 2022-03-11 14:54:04.725000             🧑  作者: Mango

代码示例2
// short example of what DIC does
class Foo
{
    public function __construct(Bar $bar)
    {
    }
}

$foo = $container->get('Foo');
// Which is equivalent to the following
$bar = new Bar;
$foo = new Foo($bar);