PHP中的get_class_methods()函数
get_class_methods()函数获取类方法的名称。它返回为name_of_class指定的类定义的方法名称的数组。如果发生错误,它将返回NULL。
语法
get_class_methods(class)
参数
name_of_class- 类名称。需要!
返回
get_class_methods()函数返回为name_of_class指定的类定义的方法名称的数组。如果发生错误,它将返回NULL。
示例
以下是一个例子-
<?php
class Demo {
function Demo() {
return(true);
}
function displayOne() {
return(true);
}
function displayTwo() {
return(true);
}
}
$method = get_class_methods('Demo');
$method = get_class_methods(new Demo());
foreach ($method as $method_name) {
echo "$method_name \n";
}
?>输出结果
Demo displayOne displayTwo
热门推荐
10 毕业祝福语小长句简短
11 学生 牛年祝福语大全简短
12 花小卡片祝福语简短
13 买车新年祝福语简短创意
14 新年祝福语简短创意 英语
15 简短的几句新年祝福语
16 新年祝福语简短搞笑创意
17 军婚祝福语兄弟文案简短
18 幼儿篮球祝福语大全简短