php - how to send data via a url in GridView in yii 2 -


'label'=>'bla',        'format' => 'raw',    'value'=>function ($data) {          return html::a(html::encode("subscribe"),'site/index'); 

i have above code , want send integer or data link. how can that? did search , found broken answer in 2 pieces

  1. how create link in gridview in yii 2
  2. how send data link

there no answer how send data link created in gridview .. above given code.

for (1.) found above mentioned code

for (2.)

yii::app()->createurl('controller/action' , array('key1' => 'value1'));

or

<?php echo chtml::link('click me',array('register/clickverifyemail',                                      'xxxx'=>'value1','ssss'=>'value2')); ?> 

and others on post

other anwsers

so know how ?

the chtml::link('click me',array('register/clickverifyemail'..... in yii1 , not yii2

the first 1 correct , can try (using test action) :

 'value' => function () {  return html::a(html::encode("subscribe"),'site/test?id='.$value1); } 

in controller value in way

public function actiontest($id){   ....    find($id);   ... } 

nb name of parameter in controller ($id) , name in link (id) must match.


Comments