我想從parameters.yml中讀取一個pareameter。 解決辦法是延長控制器,但我得到這個錯誤:Symfony:從控制器外部的parameter.yml中讀取
Error: Call to a member function getParameter() on null
我知道容器是空的,但我不知道怎麼弄的容器?
class Configuration extends Controller
{
public function __construct()
{
$this->tempFolderPath = sys_get_temp_dir();
$parameter = $this->container->getParameter('a');
}
}
任何解決方案?任何幫助?
http://symfony.com/doc/current/service_container.html閱讀本文檔,你會發現你的ANS – Shefali