get_called_class

get_called_class

(PHP 5 >= 5.3.0)

get_called_classthe "Late Static Binding" class name

说明

string get_called_class ( void )

Gets the name of the class the static method is called in.

返回值

Returns the class name. Returns FALSE if called from outside a class.

范例

Example #1 Using get_called_class()

<?php

class foo {
    static public function 
test() {
        
var_dump(get_called_class());
    }
}

class 
bar extends foo {
}

foo::test();
bar::test();

?>

以上例程会输出:

string(3) "foo"
string(3) "bar"

参见


  • call_user_method
  • call_user_method_array
  • class_alias
  • class_exists
  • get_called_class
  • get_class
  • get_class_methods
  • get_class_vars
  • get_declared_classes
  • get_declared_interfaces
  • get_object_vars
  • get_parent_class
  • interface_exists
  • is_a
  • is_subclass_of
  • method_exists
  • property_exists
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道

    无数据提示还没有评论,楼主喊你快去抢前排~~~我要评论
    微信扫码登陆

    打开 微信
    扫一扫登录