php版本从5.6切换到7.2报错Deprecated: Methods with the same name as their class will not be constructors in a

把php版本从5.6切换到7.2上,报如下错误:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP;

这个报错的原因是 PHP7 不再支持与类名相同的构造方法,构造方法统一使用 __construct(), 比如下面的写法 PHP7 就会报这个错误

改前为:

image.png

改之后为:

image.png

原文地址:https://www.codelovers.cn/article/20181008150749.html

猜你喜欢

转载自blog.csdn.net/tangjuntangjun/article/details/82968197