shuai 2015-11-13 20:23:43 6732次浏览 1条评论 4 0 0
<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],
        '_id',
        [
        'attribute'=>'title',
        'format'=>'raw',
        'value'=> function($data){
            //超链接
            return Html::a($data->title, "index.php?r=exam/index/".$data->_id, ['title' => '审核']);
        }
    ],
    'num',
    'people',
    'difficulty', 
    [
        'attribute' =>'addtime',
        'format' => ['date', 'php:Y-m-d H:i:s'],
    ],
    ['class' => 'yii\grid\ActionColumn'],
    [
        'label'=>'更多操作',
        'format'=>'raw',
        'value' => function($data) {
            $url = "http://www.baidu.com";
            return Html::a('添加权限组', $url, ['title' => '审核']);
        }
    ],
]); 
亿速云
  • 评论于 2015-11-25 10:01 举报

    注意a链接的url不是这么用de 应该如下:
    Html::a($data->title,['exam/index', 'id' => $data->_id], ['title' => '审核']);

您需要登录后才可以评论。登录 | 立即注册