yii2 detailview set value with function htmlspecialchars() expects parameter 1 to be string, object 给定

yii2 detailview set value with function htmlspecialchars() expects parameter 1 to be string, object given

如何设置 DetailView 的值。我正在尝试通过设置值 gridview 方式,但只显示错误结果

这是我写的代码

<?php echo  DetailView::widget([
    'model' => $model,
    'attributes' => [
        'username',
        'email',
        [   'label' => 'Nama',
            'value' => function($model) { return $model->first_name ." ". $model->last_name; },
        ],
    ],
]); ?>

错误是:

htmlspecialchars() expects parameter 1 to be string, object given

DetailView中不需要在value中使用function属性。

  <?php echo  DetailView::widget([
    'model' => $model,
    'attributes' => [
        'username',
        'email',
        [   'label' => 'Name',
            'value' => $model->first_name ." ". $model->last_name,
        ],
    ],
  ]); ?>