编程爱好者之家

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

2018-10-08 15:07:49 717

把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


同类文章