我已经在Composer中安装了NelmioCorsBundle,并且需要nelmio / cors-bundle,但是当我发送请求时,出现以下错误:
试图从命名空间“ App \ Nelmio \ CorsBundle”中加载类“ NelmioCorsBundle”
您是否忘记了“ Nelmio \ CorsBundle \ NelmioCorsBundle”的“使用”声明?
答案 0 :(得分:0)
您的config/bundles.php
中应包含以下行:
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true]
答案 1 :(得分:0)
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Snc\RedisBundle\SncRedisBundle::class => ['all' => true],
];