我尝试通过以下链接阅读本教程来安装FOSJsRoutingBundle:https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/blob/master/Resources/doc/index.md 但每当我运行这个命令
$ php app/console assets:install --symlink web
显示以下错误消息列表:
PHP致命错误:Class' FOS \ JsRoutingBundle \ FOSJsRoutingBundle'不 在第19行的C:\ wamp \ www \ calendar \ app \ AppKernel.php中找到
PHP堆栈跟踪:
PHP 1. {main}()C:\ wamp \ www \ calendar \ app \ console:0
PHP 2. Symfony \ Component \ Console \ Application-> run() C:\ WAMP \ WWW \日历\程序\控制台:27
PHP 3. Symfony \ Bundle \ FrameworkBundle \ Console \ Application-> doRun() C:\瓦帕\ WWW \日历\厂商\ symfony的\ symfony的\ SRC \的Symfony \元器件\控制台\ Application.php:121
PHP 4. Symfony \ Component \ HttpKernel \ Kernel-> boot() C:\瓦帕\ WWW \日历\厂商\ symfony的\ symfony的\ SRC \的Symfony \捆绑\ FrameworkBundle \控制台\ Application.php:70
PHP 5. Symfony \ Component \ HttpKernel \ Kernel-> initializeBundles() C:\ WAMP \ WWW \日历\程序\ bootstrap.php.cache:2269
PHP 6. AppKernel-> registerBundles()C:\ wamp \ www \ calendar \ app \ bootstrap.php.cache:2439
我不知道为什么它表明该课程的FOS \ JsRoutingBundle \ FOSJsRoutingBundle'尽管在app / 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 FOS\JsRoutingBundle\FOSJsRoutingBundle(),
);
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;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
那么,我该如何解决这个问题?
答案 0 :(得分:0)
添加以下行:
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
到您的app/AppKernel.php
文件。
答案 1 :(得分:-1)
看起来你已经取出了new AppBundle\AppBundle(),
一行....把它放在AppKernel中所有捆绑包的末尾,如下所示:
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 FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new AppBundle\AppBundle(),
);
);
);