Model view controller Yii2在另一个视图中从控制器获取参数到_表单

Model view controller Yii2在另一个视图中从控制器获取参数到_表单,model-view-controller,yii2,parameter-passing,Model View Controller,Yii2,Parameter Passing,我在Yii方面有问题 例如: 客户和工作机会都有积垢。我想单击客户索引上的创建按钮,该按钮将我重定向到Joboffer创建表单,在该表单中,我单击的员工的ID是可访问的。有什么建议能让我走上正确的道路吗 您应该使用函数返回HTML代码 function ($url, $model, $key) { // return the button HTML code } 这边 [ 'class' => 'yii\grid\ActionColumn',

我在Yii方面有问题

例如:

客户和工作机会都有积垢。我想单击客户索引上的创建按钮,该按钮将我重定向到Joboffer创建表单,在该表单中,我单击的员工的ID是可访问的。有什么建议能让我走上正确的道路吗


您应该使用函数返回HTML代码

  function ($url, $model, $key) {
    // return the button HTML code
  }
这边

   [
        'class' => 'yii\grid\ActionColumn',
        'template' => '{create}',
        'contentOptions'=>['style'=>'width: 25px;'],
        'buttons' => [
            'create' => function ($url, $model, $key) {
                return Html::a('<span class="glyphicon glyphicon-copy"></span>', 
                          Url::to(['joboffer/create',
                            'id' => $model->id_kunde]), ['title' => 'Create Joboffer']);
            },
        ],
    ],
[
'class'=>'yii\grid\ActionColumn',
'模板'=>'{create}',
“内容选项”=>[“样式”=>“宽度:25px;”],
“按钮”=>[
“创建”=>函数($url、$model、$key){
返回Html::a(“”,
Url::to(['joboffer/create',
“id'=>$model->id_kunde]),[“title'=>“Create Joboffer]”);
},
],
],

Html::a(创建,Url::to(['job-offer/Create','id'=>'employeeID']),选项)首先感谢您的快速回复。在您的示例中,employeeID是一个字符串,但我需要单击的员工的正确ID$这->employeeID(我的id_kunde)给了我“Getting unknown property:yii\web\View::id_kunde”,很抱歉我被消耗了。更新你的答案并显示你的客户索引视图代码..还有CustomerControllerActionIndex代码,如@scaisEdge所说,更新你的问题。