GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'id', 'name', 'server_ip', 'token', [ 'attribute' => 'status', 'label'=>'是否可用', 'value'=>function($model){ return site::status($model->status);}, ], ['class' => 'yii\grid\ActionColumn','header' => '操作'], [ 'label'=>'设置权限', 'format'=>'raw', 'value' => function($model){ $url = '/?r=app/role&id='.$model->id; return Html::a('设置', $url, ['title' => '设置']); } ] ], ]);