解决TP5.1 报错:Non-static method think\Cookie::get() should not be called statically...
在Controller类中获取Cookie时完整的报错:
Non-static method think\Cookie::get() should not be called statically, assuming $this from incompatible context
百度翻译过来的意思:假设$this来自不兼容的上下文,则不应静态调用非静态方法think\cookie::get()。
原本的在Controller类中,获取Cookie时是用静态方法获取的:
Cookie::get('name');
改成用助手函数获取就好了:
cookie('name');
还没有评论,来说两句吧...