一、日期格式化,保证点击排序的格式
参考的文章
https://segmentfault.com/a/1190000003765961
http://www.yiichina.com/tutorial/616
'columns' => [
['class' => 'yii\grid\SerialColumn'],
//'id',
'subject',
'name',
'phone',
'email:email',
'content',
'uid',
'reply',
[
'label'=>'留言时间',
'format' => ['date', 'php:Y-m-d H:i:s'], //设置时间的格式
'attribute' => 'ctime',//保持格式跟原来一致,不添加这个属性的话就没有了点击排序
'value' => 'ctime', //对应数据库字段名
'headerOptions' => ['width' => '150'],设置宽度
],
//'ctime',
[
'label'=>'回复时间',
'format' => ['date', 'php:Y-m-d H:i:s'],
'value' => 'utime',
'attribute' => 'utime',
'headerOptions' => ['width' => '150'],
],
//'utime',
['class' => 'yii\grid\ActionColumn'],
],
二、宽度的设置