PHP官方文档在解释类和对象部分下的扩展时,它说:
"When overriding methods, the parameter signature should remain the same or PHP
will generate an E_STRICT level error. This does not apply to the constructor
which allows overriding with different parameters."
所以我想知道,什么是参数签名?
文档中的示例如下:
<?php
class ExtendClass extends SimpleClass
{
// Redefine the parent method
function displayVar()
{
echo "Extending class\n";
parent::displayVar();
}
}
$extended = new ExtendClass();
$extended->displayVar();
?>
官方在线链接