我想从parameters.yml读取一个pareameter.解决方案是扩展Controller,但我收到了这个错误:
Error: Call to a member function getParameter() on null
Run Code Online (Sandbox Code Playgroud)
我知道容器是null,但我不知道如何获取容器?
class Configuration extends Controller
{
public function __construct()
{
$this->tempFolderPath = sys_get_temp_dir();
$parameter = $this->container->getParameter('a');
}
}
Run Code Online (Sandbox Code Playgroud)
有解决方案吗 有帮助吗?