thinkphp6 如何输出json数据
2023-03-29 23:03:03
1574
{{single.collect_count}}

在tp5中,我们可以使用json()方法在网页中返回json数据。

 public function show(){//定义对象数组$result=['name'=>'wangwu','age'=>11,'sex'=>'man'];//输出json数据return json($result);}

效果图
在这里插入图片描述

回帖
全部回帖({{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 ? '加载中...' : '查看更多评论'}}