问题描述
我是 Symfony2 的新手,想创建一个名为dp"的新环境.但出于某种原因,我不断收到错误消息.
I'm quite new so Symfony2 and want to create a new environment called "dp". But for some reason I keep getting errors.
FileLoaderLoadException: Cannot import resource "/a/b/c/d/e/app/config/config_dev.yml" from "/a/b/c/d/e/app/config/config_dp.yml".
InvalidArgumentException: There is no extension able to load the configuration for "web_profiler" (in /a/b/c/d/e/app/config/config_dev.yml). Looked for namespace "web_profiler", found "framework", "security", "twig", "monolog", "swiftmailer", "doctrine", "assetic", "sensio_framework_extra", "jms_security_extra", "smarty", "bela_meter", "bela_invoice", "bela_util"
我遵循了 Symfony2 文档步骤app/config/config_dp.yml 的内容是
I followed the Symfony2 documentation steps The contents of app/config/config_dp.yml is
imports:
- { resource: config_dev.yml }
并且 web/app_dp.php 包含:
And web/app_dp.php contains:
$kernel = new AppKernel('dp', true);
$kernel->loadClassCache();
$kernel->handle(Request::createFromGlobals())->send();
我该如何解决这个问题?config_dev.yml 环境完美无缺.
How can I fix this? config_dev.yml environment works flawless.
推荐答案
默认情况下,WebProfilerBundle
仅在 dev
和 test
环境中加载.在您的 AppKernel
类中找到此代码片段:
By default, WebProfilerBundle
is loaded in dev
and test
environments only. Find this code snippet in your AppKernel
class:
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
// ...
}
并将您的新环境名称附加到数组中:
and append your new environment name to the array:
array('dev', 'test', 'dp')
这篇关于没有能够加载“web_profiler"配置的扩展程序.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!