Classes/Object 函数
php 手册 | 脚本学堂 | 脚本编程 | 网站编程 | 系统管理 | 服务器配置 | 数据库管理 | Php教程 | python教程 | 正则表达式 | 批处理脚本 | Centos教程 | Linux基础教程

method_exists

(PHP 4, PHP 5)

method_exists检查类的方法是否存在

说明

bool method_exists ( object $object , string $method_name )

如果 method_name 所指的方法在 object 所指的对象类中已定义,则返回 TRUE,否则返回 FALSE

Example #1 method_exists() 例子

<?php
$directory 
= new Directory('.');
var_dump(method_exists($directory,'read'));
?>

上例将输出:

bool(true)

参见 function_exists()is_callable()


Classes/Object 函数
php 手册 | 脚本学堂 | 脚本编程 | 网站编程 | 系统管理 | 服务器配置 | 数据库管理 | Php教程 | python教程 | 正则表达式 | 批处理脚本 | Centos教程 | Linux基础教程