严格标准:响应声明:: toXML()错误

ali*_*s51 2 php plivo

我有一个PHP脚本中显示的跟随错误.

Strict Standards: Declaration of Response::toXML() should 
be compatible with Element::toXML($header = false) in line 35
Run Code Online (Sandbox Code Playgroud)

这条线是require_once ('./plivo.php');; 导入plivo.com PHP助手.

任何人都可以告诉我这个错误是什么以及我如何解决它?

谢谢

Ste*_*e O 8

您可能已经想到了这一点,但是如果您确实想要修复错误而不是更改错误报告的级别,则需要更改以下内容:

// In the plivo.php helper file we're looking at
// the Response class that extends the Element class
// Change the following function from:
public function toXML() {
    $xml = parent::toXML($header=TRUE);
    return $xml;
}

// To:
public function toXML($header=TRUE) {
    $xml = parent::toXML($header);
    return $xml;
}
Run Code Online (Sandbox Code Playgroud)

问题是childClass :: method()有不同的parentClass :: method()参数,如notJim的答案所述.希望这很有帮助.