- 相關(guān)推薦
PHP類(lèi)相關(guān)函數(shù)的使用代碼詳解
bool class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) — 為一個(gè)類(lèi)創(chuàng)建別名
bool class_exists ( string $class_name [, bool $autoload ] )— 檢查類(lèi)是否已定義
string get_called_class ( void ) —獲取靜態(tài)方法調(diào)用的類(lèi)名
復(fù)制代碼 代碼如下:
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 )— 返回由類(lèi)的方法名組成的數(shù)組
array get_class_vars ( string $class_name )— 返回由類(lèi)的默認(rèn)屬性組成的數(shù)組
string get_class ([ object $obj ] )— 返回對(duì)象的類(lèi)名
array get_declared_classes ( void )— 返回當(dāng)前腳本中已定義類(lèi)的名字組成的數(shù)組
array get_declared_interfaces ( void )— 返回當(dāng)前腳本中所有已聲明的接口的名字?jǐn)?shù)組
array get_object_vars ( object $obj )— 返回由對(duì)象屬性組成的關(guān)聯(lián)數(shù)組
string get_parent_class ([ mixed $obj ] )— 返回對(duì)象或類(lèi)的父類(lèi)名
bool interface_exists ( string $interface_name [, bool $autoload ] )— 檢查接口是否已被定義
bool is_a ( object $object , string $class_name )— 如果對(duì)象屬于該類(lèi)或該類(lèi)是此對(duì)象的父類(lèi)則返回 TRUE
bool is_subclass_of ( object $object , string $class_name )— 檢測(cè)對(duì)象是該類(lèi)的子類(lèi)實(shí)例化得到的
bool method_exists ( object $object , string $method_name )— 檢查類(lèi)的方法是否存在
bool property_exists ( mixed $class , string $property ) — 檢查對(duì)象或類(lèi)是否具有該屬性
【PHP類(lèi)相關(guān)函數(shù)的使用代碼詳解】相關(guān)文章:
php對(duì)圖像的各種處理函數(shù)代碼總結(jié)07-03
php數(shù)組函數(shù)序列之a(chǎn)rray-combine() - 數(shù)組合并函數(shù)的代碼08-25
關(guān)于深入PHP內(nèi)存相關(guān)的功能特性詳解09-02
關(guān)于PHP var-dump遍歷對(duì)象屬性的函數(shù)與應(yīng)用代碼06-21
PHP的壓縮函數(shù)06-21
淺析php函數(shù)的實(shí)例06-08
php如何過(guò)濾危險(xiǎn)html代碼09-21
將php實(shí)現(xiàn)過(guò)濾UBB代碼09-11