-1
首先我是Symfony2的新手。Symfony2無法生成url
當我跑我的項目,它的顯示下一個錯誤:
An exception has been thrown during the rendering of a template ("Unable to
generate a URL for the named route "/contact/" as such route does not exist.")
in frontendiniciBundle:Default:index.html.twig at line 4.
在/frontend/iniciBundle/Resources/config/routing.yml
frontendinici_homepage:
path: /index/
defaults: { _controller: frontendiniciBundle:Principal:index }
frontendinici_contact:
path: /contacto/
defaults: { _controller: frontendiniciBundle:Principal:contact }
途徑和控制器的代碼
class PrincipalController extends Controller
{
public function indexAction()
{
return $this->render('frontendiniciBundle:Default:index.html.twig', array('contactourl' => '/contacto/'));
}
public function contactAction(){
return $this->render('frontendiniciBundle:Default:contact.html.twig');
}