thinkphp5.1 _initialize初始化方法不执行问题
2022-07-28 14:14:58
128
{{single.collect_count}}

thinkphp5.1的初始化方法名称已修改成了 initialize,前面不带下划线,使用新版这个要注意哦。

thinkphp5.1的初始化方法名改为initialize去掉了之前的下划线,在 使用/重写 的时候应该注意将其声明为protected类型的,若直接声明为public类型,则其功能和普通方法无二,也就是说可以被用户访问到,并且会被执行两次。

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