PHP已弃用:具有相同名称的方法

时间:2016-05-08 13:29:23

标签: php

我收到错误说

  

不推荐使用:与其类同名的方法将不会是PHP未来版本中的构造函数; TSStatus在第10行的C:\ Program Files(x86)\ Zend \ Apache24 \ htdocs \ viewer \ modules \ tsstatus \ tsstatus.php中有一个弃用的构造函数

类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)

    ...
}

1 个答案:

答案 0 :(得分:98)

如错误中所述,the official manual和评论:

替换

public function TSStatus($host, $queryPort)

public function __construct($host, $queryPort)