symfony2 多条路线
示例
在Symfony中,可以为一个动作定义多个路径。如果您具有功能相同但参数不同的函数,则这将非常有用。
class TestController extends Controller
{
/**
* @Route("/test1/{id}", name="test")
* @Route("/test2/{id}", name="test2")
* Here you can define multiple routes with multiple names
*/
public function testAction(Test $test)
{
if (!$test) {
throw $this->createNotFoundException('Test record not found.');
}
return $this->render('::Test/test.html.twig', array('test' => $test));
}
}
热门推荐
10 毛笔哥哥结婚祝福语简短
11 向国庆送祝福语简短
12 建队节祝福语简短
13 朋友喜得外孙简短祝福语
14 小店营业的祝福语简短
15 餐饮生日祝福语简短独特
16 鲜花英语祝福语卡片简短
17 男朋友暴富祝福语简短
18 婶婶拜年祝福语大全简短