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 教师闺蜜祝福语简短