PHP中的method_exists()函数
method_exists()函数检查类方法是否存在。
语法
method_exists(object, name_of_method)
参数
object- 对象实例或类名
name_of_method- 方法名称
返回
如果为给定对象定义了method_name给定的方法,则method_exists()函数返回TRUE,否则返回FALSE。
示例
以下是一个例子-
<?php
$directory = new Directory('.'); var_dump(method_exists($directory,'anything'));
?>输出结果
bool(false)
示例
<?php
var_dump(method_exists('Directory','read'));
?>输出结果
bool(true)
热门推荐
10 诗词送行祝福语大全简短
11 新房开工吉日祝福语简短
12 50多岁生日简短祝福语
13 安徽疫情祝福语简短英语
14 农民朋友发财祝福语简短
15 对生活祝福语简短精辟
16 搬家词简短祝福语朋友
17 女神结婚快乐祝福语简短
18 文学短句祝福语大全简短