这篇文章主要介绍了yii2.0之GridView自定义按钮和链接用法,是非常实用的使用GridView进行表单操作技巧,需要的朋友可以参考下
本文实例讲述了yii2.0之GridView自定义按钮和链接用法。分享给大家供大家参考。具体实现方法如下:
复制代码 代码如下:
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
//显示的字段
//code的值
['attribute'=>'这是测试code','value'=>function(){return 'abc';}],
'name',
'population',
['class' => 'yii\grid\ActionColumn','header' => '操作',],
[
'label'=>'更多操作',
'format'=>'raw',
'value' => function($data){
$url = "http://www.baidu.com";
return Html::a('添加权限组', $url, ['title' => '审核']);
}
]
],
]); ?>
运行效果如下图所示:
希望本文所述对大家基于Yii框架的PHP程序设计有所帮助。
,
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool