@php($adlist = inseradqu($info))
php怎么检查类方法是否存在
时间:2021-07-19 来源:互联网
今天PHP爱好者为您带来php检查类方法是否存在的方法是,使用method_exists方法来检查,例如【(method_exists($directory,'read'));】。希望对大家有所帮助。
本文操作环境:windows10系统、php 7.3、thinkpad t480电脑。
method_exists检查类的方法是否存在。如果 method_name 所指的方法在 object 所指的对象类中已定义,则返回 true,否则返回 false。
代码示例:
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read'));
?>
以上例程会输出:
bool(true)
示例2
<?php
var_dump(method_exists('Directory','read'));
?>
以上例程会输出:
bool(true)
以上就是php怎么检查类方法是否存在的详细内容,更多请关注php爱好者其它相关文章!
相关阅读更多 +
-
币安怎么购买First币?First购买教程与币安binance下载入口 2025-05-15
-
币安怎么购买Pay币?Pay购买教程与币安binance下载入口 2025-05-15
-
《“马上就到”的距离单位是什么?》 2025-05-15
-
币安怎么购买Attention币?Attention购买教程与币安binance下载入口 2025-05-15
-
币安怎么购买MATIC币?MATIC购买教程与币安binance下载入口 2025-05-15
-
《为什么我的灵感总是在洗澡的时候出现?》 2025-05-15
最近更新