PHP 類相關函數的使用詳解_PHP教程

來源:互聯網
上載者:User
bool class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) — 為一個類建立別名
bool class_exists ( string $class_name [, bool $autoload ] )— 檢查類是否已定義
string get_called_class ( void ) —擷取靜態方法調用的類名
複製代碼 代碼如下:
class foo {
static public function test(){
var_dump(get_called_class());
}
}
class bar extends foo {}
foo::test();
bar::test();

array get_class_methods ( mixed $class_name )— 返回由類的方法名組成的數組
array get_class_vars ( string $class_name )— 返回由類的預設屬性組成的數組
string get_class ([ object $obj ] )— 返回對象的類名
array get_declared_classes ( void )— 返回當前指令碼中已定義類的名字組成的數組
array get_declared_interfaces ( void )— 返回當前指令碼中所有已聲明的介面的名字數組
array get_object_vars ( object $obj )— 返回由對象屬性群組成的關聯陣列
string get_parent_class ([ mixed $obj ] )— 返回對象或類的父類名
bool interface_exists ( string $interface_name [, bool $autoload ] )— 檢查介面是否已被定義
bool is_a ( object $object , string $class_name )— 如果對象屬於該類或該類是此對象的父類則返回 TRUE
bool is_subclass_of ( object $object , string $class_name )— 檢測對象是該類的子類執行個體化得到的
bool method_exists ( object $object , string $method_name )— 檢查類的方法是否存在
bool property_exists ( mixed $class , string $property ) — 檢查對象或類是否具有該屬性

http://www.bkjia.com/PHPjc/326986.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326986.htmlTechArticlebool class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) — 為一個類建立別名 bool class_exists ( string $class_name [, bool $autoload ] )— 檢查類...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.