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 出阁宴祝福语姐姐简短