Dưới đây là ví dụ:
class Test {
public function TestMethod() {
print_r($this); // Gives me "Test1 Object ()"
}
}
class Test1 {
public function Test1Method() {
Test::TestMethod();
}
}
$test1 = new Test1;
$test1->Test1Method();
Tôi thấy điều này thật lạ. Bất cứ ai có thể vui lòng giải thích cho tôi tại sao nó xảy ra?
Tôi đã hỏi một câu hỏi rất giống (Không phải một câu hỏi). Các câu trả lời rất hữu ích http://stackoverflow.com/questions/516355/calling-static-method-from-class-bwhich-extends-class-a-of-class-a –