最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php method_exists()函数用法
时间:2022-06-24 19:48:46 编辑:袖梨 来源:一聚教程网
method_exists
(PHP 4, PHP 5, PHP 7)
method_exists — 检查类的方法是否存在
说明
bool method_exists ( mixed $object , string $method_name )
如果 method_name 所指的方法在 object 所指的对象类中已定义,则返回 TRUE,否则返回 FALSE。
代码如下 | 复制代码 |
class a { public function yy() { $obj = new a(); var_dump(method_exists($obj, ‘xx’)); 测试结果都为true class a { public function yy() { public function yy() { $obj = new a(); |
以上语句报错。
例子
代码如下 | 复制代码 |
// 获取要运行的action // 加载controller文件 if ( isset($_GET['m']) ) { |
相关文章
- 《弓箭传说2》新手玩法介绍 01-16
- 《地下城与勇士:起源》断桥烟雨多买多送活动内容一览 01-16
- 《差不多高手》醉拳龙技能特点分享 01-16
- 《鬼谷八荒》毕方尾羽解除限制道具推荐 01-16
- 《地下城与勇士:起源》阿拉德首次迎新春活动内容一览 01-16
- 《差不多高手》情圣技能特点分享 01-16