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 好听的元旦简短祝福语