PHP版本在升级到高版本的时候往往会出现某些函数或语法被屏弃的现象,笔者环境从PHP 5.5 升级到PHP 7.0的时候原来的站点访问的时候就出现了如下错误:
PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AES has a deprecated constructor in
从上面英文错误的字面上理解是在定义类的时候使用了与类名相同的函数名称,在PHP5里运行实际是没有报错的,但在PHP 7里就不允许这样写,解决办法很简单,只要把与类名相同的函数名改为“__construct”,也就是我们熟知的构造函数咯。
扫码关注公众号
长沙网站设计,长沙软件开发,长沙进销存开发,php进销存系统,ViooMa收银系统,ThinkPHP框架进销存系统
湘ICP备19023859号-1
Copyright©2020 长沙唯马网络科技有限公司. All Rights Reserved.
2023-07-22 15:26:56
345345345345
2023-06-19 14:51:27
111111111111111111
2022-11-12 20:17:43
Methods with the same name as their class will not be constructors in a future version of PHP; Services_JSON has a deprecated constructor in D:\wwwroot\aixinan.cn\include\kindeditor\JSON.php on line 58