Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 views
in Technique[技术] by (71.8m points)

PHP Deprecated: Methods with the same name

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)endApache24htdocsviewermodulessstatussstatus.php on line 10

class TSStatus is line 10 plus at the bottom TSStatus shows

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)

    ...
}
Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As mentioned in the error, the official manual and the comments:

Replace

public function TSStatus($host, $queryPort)

with

public function __construct($host, $queryPort)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...