我已经设置了一个新的控制器,当我运行时
./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")
单引号通过以下方式抛出错误:预期的PlainValue,在第26位得到”’