這裏是一個例子:
class Test {
public function TestMethod() {
print_r($this); // Gives me "Test1 Object ()"
}
}
class Test1 {
public function Test1Method() {
Test::TestMethod();
}
}
$test1 = new Test1;
$test1->Test1Method();
我覺得這很奇怪。任何人都可以向我解釋爲什麼會發生?
我問了一個非常相似的問題(不是一個愚蠢的問題)。答案是非常有用的http://stackoverflow.com/questions/516355/calling-static-method-from-class-bwhich-extends-class-a-of-class-a – 2011-01-21 15:16:00