Thinkphp6知识点九——视图
2022-11-24 11:10:29
143
{{single.collect_count}}

视图:模板赋值与模板输出 

namespace app\controller;use think\facade\View;class Index{//第一种输出方法public function index(){// 模板变量赋值View::assign('name','ThinkPHP');View::assign('email','thinkphp@qq.com');// 或者批量赋值View::assign(['name'=> 'ThinkPHP','email' => 'thinkphp@qq.com']);// 模板输出return View::fetch('index');}//第二种输出方法 public function index(){// 模板输出并变量赋值return View::fetch('index', ['name'=> 'ThinkPHP','email' => 'thinkphp@qq.com']);} //第三种输出方法 public function index(){// view()助手函数return view('index', ['name'=> 'ThinkPHP','email' => 'thinkphp@qq.com']);}}
回帖
全部回帖({{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 ? '加载中...' : '查看更多评论'}}