为什么静态函数f2()
中无法识别name
常量?
class Foo {
protected static function f1($s) {
echo "doing $s";
}
}
class Bar extends Foo {
const name = 'leo';
public static function f2() {
Foo::f1(name);
}
}
$bar = new Bar();
$bar->f2();
I get the following error:
Notice: Use of undefined constant name - assumed 'name' in ...
我做错了什么?