gpt4 book ai didi

php - 为什么在我访问 app.php 时我的 Symfony2 安装出现 404ing?

转载 作者:IT王子 更新时间:2023-10-29 00:57:13 27 4
gpt4 key购买 nike

在 Symfony2 中,当通过 app_dev.php 在本地访问我的应用程序时,一切正常。但是,当我访问 app.php 时出现 404s:

Oops! An Error Occurred

The server returned a "404 Not Found".

Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for

最佳答案

全新的 symfony 2 安装不包含任何生产环境的路由。如果您查看 app/config/routing_dev.yml,您会注意到您在演示应用程序中看到的所有路由都是仅为开发定义的。如果你想在 app.php 上测试 demo,你必须先将路由从 routing_dev.yml 复制到 routing.yml,然后同时在你的 AppKernel.php 下启用 AcmeDemoBundle:

$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
+ new Acme\DemoBundle\AcmeDemoBundle()
}

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
- $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}

(+是你应该添加的行,-是你应该删除的行)

关于php - 为什么在我访问 app.php 时我的 Symfony2 安装出现 404ing?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6997543/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com