php報錯,調用非對象上的成員函數validate
1 回答

慕桂英546537
TA貢獻1848條經驗 獲得超10個贊
命名空間Venom \ CoreBundle;使用Symfony \ Component \ HttpKernel \ Bundle \ Bundle;use \ Symfony \ Component \ DependencyInjection \ ContainerInterface;VenomCoreBundle類擴展了Bundle{
private static $ containerInstance = null;
public function setContainer(ContainerInterface $ container = null)
{
父:: setContainer($容器);
self :: $ containerInstance = $ container;
}
public static function getContainer()
{
return self :: $ containerInstance;
}
}
使用適當的命名空間。然后,在需要容器的類中使用bundle的命名空間。您可以通過調用容器
$ container = VenomCoreBundle :: getContainer()
- 1 回答
- 0 關注
- 952 瀏覽
添加回答
舉報
0/150
提交
取消