弃用警告:与其类同名的方法
在 PHP 中,与其类同名的方法将不再被使用未来版本中的构造函数。当构造函数方法的名称与类名称匹配时,就会出现此问题。
错误消息:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; TSStatus has a deprecated constructor in ... on line 10
受影响的代码:
class TSStatus
{
...
public function TSStatus($host, $queryPort)
...
}
解决方案:
将 TSStatus 方法替换为 __construct.
class TSStatus
{
...
public function __construct($host, $queryPort)
...
}
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3