URL in Yii2 GridView

后端 未结 8 2005
后悔当初
后悔当初 2020-12-15 15:09

I have this code:

 $dataProvider,
  \'filterModel\' => $searchModel,
  \'columns\' => [
    [\         


        
8条回答
  •  悲&欢浪女
    2020-12-15 15:34

    I got the solution from Samdark, contributor of yii. need to use format=>'raw':

    ...    
    'format' => 'raw',
         'value'=>function ($data) {
            return Html::a(Html::encode("View"),'site/index');
        },
    

    need to use Html::encode() to ecape XSS

提交回复
热议问题