0
我與這個細節掙扎,而在Symfony2中定義的路由路由Symfony2的可選參數沒有價值
彌路由:
blog:
path: /blog/{page}
defaults: { _controller: ManualRouteBundle:Blog:show, page: 33 }
我的控制器:
<?php
namespace Manual\RouteBundle\Controller ;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class BlogController extends Controller{
public function showAction($page){
return $this->render('ManualRouteBundle:Blog:show.html.twig') ;
}
}
我的看法:
Blog # {{page}}
Wh恩我嘗試用這個地址的
http://test/web/blog
代替
http://test/web/blog/1
訪問我得到這個錯誤
Variable "page" does not exist in ManualRouteBundle:Blog:show.html.twig at line 1
500 Internal Server Error - Twig_Error_Runtime
是不是應該是33頁的價值?