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
热门推荐
7 庆双节祝福语简短
9 合字的祝福语简短
10 祖国七十华诞简短祝福语
11 祝福语诗意文案简短
12 许嵩生日祝福语简短
13 万寿祝福语简短
14 朋友孩子考试祝福语简短
15 春节后的祝福语简短
16 俄语祝福语贺卡文案简短
17 写给情侣祝福语 浪漫简短
18 好听的元旦简短祝福语