这个问题与我在生产环境中包含调试资源的事实有关。我正在对缓存机制进行测试,忘记从 config.yml 和 AppKernel.php 文件中删除包含。
if (in_array($this->getEnvironment(), ['dev','test','prod'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
//... Extensions From Base
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
}
因此,AppKernel 实例化需要将调试参数设置为 true。
$kernel = new AppKernel('prod', true);
否则它会导致我问这个问题要解决的最初问题。