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));
}
}
热门推荐
6 保研的祝福语简短
10 年轻20岁祝福语简短
11 朋友结婚祝福语信息简短
12 女孩婚礼贺卡祝福语简短
13 30段点歌简短祝福语
14 虎年春节祝福语图文简短
15 写给后妈祝福语大全简短
16 简短回复生日祝福语
17 校长送毕业祝福语简短
18 毕业立体贺卡祝福语简短