yii gridview 使用target=”_blank”无效

解决办法是设置format为raw:

        [
            'attribute' => 'attribute',
            'format' => 'raw',
            'value' => function ($model, $key, $index, $column) {
                return  Html::a($model->title, ['view', 'id' => $model->id], ['target' => '_blank']);
            },
        ],

发表评论