ThinkPHP开发技巧集锦(6):设置数据库返回查询结果类型array/collection
2022-11-24 11:10:29
142
{{single.collect_count}}

将array->collection

1、直接转换

collection($result)->hidden(['time','type']);

2、提前设置(database.php)

//'resultset_type'=> 'array','resultset_type'=> 'collection',

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}