为什么我的 Controller 不工作但抛出 FileLoaderException?
Why isn't my Controller working but throwing a FileLoaderException?
我设置了一个新的控制器,当我 运行
./app/console router:debug
我收到错误:
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "/home/dev/Workspace/src/Hn/AssetDbBundle/Controller/" from "/home/dev/Workspace/app/config/routing.yml". ([Syntax Error] Expected PlainValue, got ''' at position 26 in method Hn\AssetDbBundle\Controller\Component\UnsupportedBrowserController::renderUnsupportedBrowserMessageAction().)
我的控制器看起来像这样:
<?php
namespace Hn\AssetDbBundle\Controller\Component;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class UnsupportedBrowserController
* @Route("/_internal/browser/", name="component_browser")
*
*/
class UnsupportedBrowserController extends Controller
{
/**
* @Template()
* @Route('unsupported')
*/
public function renderUnsupportedBrowserMessageAction()
{
return [];
}
}
注释需要使用双引号,在本例中:
* @Route("unsupported")
单引号在抱怨时抛出错误:Expected PlainValue, got ''' at position 26
我设置了一个新的控制器,当我 运行
./app/console router:debug
我收到错误:
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "/home/dev/Workspace/src/Hn/AssetDbBundle/Controller/" from "/home/dev/Workspace/app/config/routing.yml". ([Syntax Error] Expected PlainValue, got ''' at position 26 in method Hn\AssetDbBundle\Controller\Component\UnsupportedBrowserController::renderUnsupportedBrowserMessageAction().)
我的控制器看起来像这样:
<?php
namespace Hn\AssetDbBundle\Controller\Component;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class UnsupportedBrowserController
* @Route("/_internal/browser/", name="component_browser")
*
*/
class UnsupportedBrowserController extends Controller
{
/**
* @Template()
* @Route('unsupported')
*/
public function renderUnsupportedBrowserMessageAction()
{
return [];
}
}
注释需要使用双引号,在本例中:
* @Route("unsupported")
单引号在抱怨时抛出错误:Expected PlainValue, got ''' at position 26