[PHP] Deprecated: Methods with the same name as their class will not be constructor...
来源:互联网 发布:过山车大亨3 mac 中文 编辑:程序博客网 时间:2024/06/07 21:11
最近刚把php版本从5.6切换到7.0上,但是再重新打开项目时,报如下错误:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP;
Smarty has a deprecated constructor in /www/platform/library/Platform/View/Smarty/Smarty.class.php
原来是smarty模板类还是使用了php4的构造函数的写法,所以找到smarty类后,找到与类同名的函数,将函数名改
为__construct即可。
PHP OOP使用和类名相同的方法名作为构造方法,是 PHP4 的写法,PHP 5中同时支持__construct和类同名方法,但__construct方法具有优先性。
PHP 7开始使用和类名相同的方法名作为构造方法会报E_DEPRECATED级别的错误,提示在未来版本中会彻底抛弃类同名方法作为
构造函数。
但程序仍然会正常执行。
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP 的解决方法是使用__construct作为
构造方法的方法名。即:
阅读全文
0 0
- [PHP] Deprecated: Methods with the same name as their class will not be constructor...
- MBean with the same name could not be unregisted
- CXF A class/interface with the same name 问题
- ES报错:Can not be imported as a dangling index as index with same name already exists in cluster me
- Struts2 SEOActionNameBuild (The action name cannot be the same as the action suffix [Action]) 终极解决方案
- Struts2 SEOActionNameBuild (The action name cannot be the same as the action suffix [Action]) 终极解决方案
- 解决PHP中Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the futu
- php 报: 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the f
- Notice: Zend_Loader::Zend_Loader::registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Aut
- Notice: Zend_Loader::Zend_Loader::registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Aut
- Python is not installed as a framework. The Mac OS X backend will not be a
- wo or more files with the name of logging.cc will produce outputs to the same location.
- The action name cannot be the same as the action suffix [Action]遇到此有关问题的解决办法
- A new node couldn't be inserted because one with the same name exists. (VERR_CFGM_NODE_EXISTS)
- Embedded binary is not signed with the same certificate as the parent app解决方案
- ios Embedded binary is not signed with the same certificate as the parent app. 解决办法
- Embedded binary is not signed with the same certificate as the parent app
- This platform could not be created because a solution platform of the same name already exists.
- android 进程通讯数据为什么要实现序列化
- 快速学习COSMIC之一:COSMIC方法的简单案例
- 点击 Android Studio 的 build 按钮后发生了什么(阿里巴巴)
- ios 同时重写setter和getter方法
- C++学习之路(23)---C++ explicit关键字详解
- [PHP] Deprecated: Methods with the same name as their class will not be constructor...
- memcached三种客户端的使用
- 积攒了这么多技术干货_总有一款适合你
- pod install Abort trap: 6
- Prim 最小生成树 POJ1287(模板)
- 原码, 反码, 补码 详解
- ETH挖矿软件之矿工队长
- QT5.7 Windows下发布release程序
- 利用Angular实现多团队模块化SPA开发框架