我有这个代码:
<?php echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yiigridSerialColumn'],
[
'label' => 'bla',
'format' => 'url',
'value' => function ($data) {
return Html::url('site/index');
},
],
['class' => 'yiigridActionColumn'],
],
]); ?>
在网格视图中生成带有 URL 地址的文本.
In grid view text is being generated with URL address.
/academia-new/advanced/admin/site/index
URL 工作正常,但如何为链接设置文本?
URL is working fine, but how can I set a text for link?
Use 'format' =>'raw'
而不是 'format' =>'url'
.
这篇关于Yii2 GridView 中的 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!