整理一下,三種取得當前類別名稱的方法(假設程式檔名:test.php):
<?php
namespace Main0001 {
    class A {
        function test1() {
            $r = new \ReflectionClass($this);
            echo $r->getName() . "\n";
        }
        function test2() {
            echo get_class($this) . "\n";
        }
        function test3() {
            echo __CLASS__ . "\n";
        }
    }
}
namespace {
    use Main0001\A;
    $a = new A;
    $a->test1();//print: Main0001\A
    $a->test2();//print: Main0001\A
    $a->test3();//print: Main0001\A
}
然後執行php test.php,就會印三次。
$this 你可以將其視為一種魔術變數。
跟$_POST $_GET這些一樣。
基本上來說,$this只會在class才會看到。
依以下例子為例
class test(){
    function get(){
        $this->out();
    }
    function out(){
        echo "OUT!!!";
    }
}
$c = new test();
$c->get(); //會輸出OUT!!!
其中在get內的$this,其實指的就是test這個class
這是物件的一種變數用法。
這只是一種魔術變數。