小编Dav*_*nez的帖子

致命错误:AppKernel.php中找不到类

我在Symfony文档之后生成了一个新的Bundle(ImgBundle),但是当在浏览器中重新加载应用程序时,它无法识别该bundle的主类.

这是我的ImgBundle.php:

<?php

namespace ImgBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ImgBundle extends Bundle
{
}
Run Code Online (Sandbox Code Playgroud)

AppKernel.php:

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
        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 Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new AppBundle\AppBundle(),
        new ImgBundle\ImgBundle(),
    ];

    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();

        if ('dev' === $this->getEnvironment()) {
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new …
Run Code Online (Sandbox Code Playgroud)

php bundle symfony

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

bundle ×1

php ×1

symfony ×1