路由参数symfony


route parameter symfony

我定义了这个路由

teln_operator_edit_1:
    pattern:  /edit1/{id}/{step}
    defaults: { _controller: TelnOperatorBundle:Operator:step1 }

我得到

/Symfony/web/app_dev.php/edit1/13/1我想得到阶跃值怎么做?

您将在操作方法中获得URL参数值作为参数:

public function step1Action($id, $step) {
    // ...
}

确保方法参数名称与模式中的参数名称等效。