搜索
首页php教程php手册PHP函数:method_exists和function_exists

PHP函数:method_exists和function_exists

Jun 13, 2016 am 11:31 AM
existsfunctionmethodphp函数方法检查

method_exists

检查类的方法是否存在

<span 1</span> bool <span method_exists</span> ( <span mixed</span> <span $object</span> , <span string</span> <span $method_name</span> )

检查类的方法是否存在于指定的object中

参数:

object:对象示例或类名

method_name:方法名

返回值:

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

注释:

如果此类不是已知类,使用此函数会使用任何已注册的autoloader。

function_exists

若提供的方法已经定义,则返回TRUE。

<span 1</span> bool <span function_exists</span> ( <span string</span> <span $function_name</span> )

检查已定义的方法列表,包括内置的(PHP内部的)和用户定义的。

参数:

方法名,字符串类型。

返回值:

当方法名存在且为方法时,返回TRUE,否则返回FALSE。

note:

This function will return FALSE for constructs, such as include_once and echo.

 

 

 

 

 

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

VSCode Windows 64位 下载

VSCode Windows 64位 下载

微软推出的免费、功能强大的一款IDE编辑器

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

Dreamweaver Mac版

Dreamweaver Mac版

视觉化网页开发工具

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版