thinkphp6 使用token助手函数 报错Call to a member function set() on null
2022-11-24 11:10:29
131
{{single.collect_count}}

原因

由于助手函数调用了session,但是我们并没有启用,所以报错了。

解决

在全局中间件middleware.php文件,配置

'think\middleware\SessionInit'

如果是多应用模式,可以在应用里的middleware.php文件进行配置

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