- 相關(guān)推薦
PHP類相關(guān)函數(shù)的使用代碼詳解
bool class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) — 為一個類創(chuàng)建別名
bool class_exists ( string $class_name [, bool $autoload ] )— 檢查類是否已定義
string get_called_class ( void ) —獲取靜態(tài)方法調(diào)用的類名
復(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 )— 返回由類的方法名組成的數(shù)組
array get_class_vars ( string $class_name )— 返回由類的默認屬性組成的數(shù)組
string get_class ([ object $obj ] )— 返回對象的類名
array get_declared_classes ( void )— 返回當(dāng)前腳本中已定義類的名字組成的數(shù)組
array get_declared_interfaces ( void )— 返回當(dāng)前腳本中所有已聲明的接口的名字數(shù)組
array get_object_vars ( object $obj )— 返回由對象屬性組成的關(guān)聯(lián)數(shù)組
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 ) — 檢查對象或類是否具有該屬性
【PHP類相關(guān)函數(shù)的使用代碼詳解】相關(guān)文章:
Excel中if函數(shù)使用的方法06-16
Excel中COUNTIF函數(shù)的使用方法01-23
數(shù)控編程代碼大全02-13
php實習(xí)心得12-01
php實習(xí)報告11-07
excel函數(shù)07-30
Java代碼的基本知識09-03
php工作總結(jié)11-11
php是什么格式?01-14