PHP 弃用:具有相同名称的方法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37100373/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP Deprecated: Methods with the same name
提问by Manfred Radlwimmer
I am getting an error saying
我收到一条错误消息
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 C:\Program Files (x86)\Zend\Apache24\htdocs\viewer\modules\tsstatus\tsstatus.php on line 10
不推荐使用:与它们的类同名的方法在 PHP 的未来版本中将不再是构造函数;TSStatus 在第 10 行的 C:\Program Files (x86)\Zend\Apache24\htdocs\viewer\modules\tsstatus\tsstatus.php 中有一个已弃用的构造函数
class TSStatus is line 10 plus at the bottom TSStatus shows
类 TSStatus 是第 10 行加上底部 TSStatus 显示
class TSStatus
{
private $_host;
private $_queryPort;
private $_serverDatas;
private $_channelDatas;
private $_userDatas;
private $_serverGroupFlags;
private $_channelGroupFlags;
private $_login;
private $_password;
private $_cacheFile;
private $_cacheTime;
private $_channelList;
private $_useCommand;
private $_javascriptName;
private $_socket;
public $imagePath;
public $showNicknameBox;
public $timeout;
public $hideEmptyChannels;
public $hideParentChannels;
public function TSStatus($host, $queryPort)
...
}
回答by Manfred Radlwimmer
As mentioned in the error, the official manualand the comments:
正如错误中提到的,官方手册和评论:
Replace
代替
public function TSStatus($host, $queryPort)
with
和
public function __construct($host, $queryPort)