0
我正在学习使用symfony和doctrine,而我面临的问题是我找不到解决方案。 这是关于路由文件。我有一个名为“LinkBundle”包中,我创建了一个“的routing.yml”文件到“LinkBundle /资源/配置/ routing.yml中”我无法加载资源
还有就是我的路由文件到应用程序/资源:
projet_php_link:
resource: "@ProjetPhpLinkBundle/Resources/config/routing.yml"
type: annotation
prefix: /
当我进入我的网站时,出现以下错误:“无法加载资源”@ProjectPhpLinkBundle/Resources/config/routing.yml“确保”ProjetPhpLinkBundle/Resources/config/routing.yml“包已正确注册并加载到应用程序内核类中。“
还有就是我AppKernel.php:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$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\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new ProjetPhp\Bundle\UserBundle\ProjetPhpUserBundle(),
new ProjetPhp\Bundle\LinkBundle\ProjetPhpLinkBundle(),
new ProjetPhp\Bundle\TagBundle\ProjetPhpTagBundle(),
new FOS\UserBundle\FOSUserBundle(),
);
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();
}
return $bundles;
}
你能帮助我吗?
检查大写字母,有时一个错字关于它发生。 –
其实我是新的symfony,但是如果你加载资源类型注释,它不是一个xlm文件吗?为什么它是一个XML文件? –
我试图在类型字段中输入“yml”而不是“注释”。我有同样的错误。 – user2302725