0
点赞
收藏
分享

微信扫一扫

php常见的判断函数

狗啃月亮_Rachel 2022-04-02 阅读 82
php


一、文件、目录

1、is_file();//文件是否存在

2、is_dir();//目录是否存在

二、函数、类、接口

1、function_exists();//函数是否存在

bool ​function_exists​ ( string ​​$function_name​​ )

2、class_exists();//检测类是否已定义

bool ​class_exists​ ( string ​​$class_name​​ [, bool ​​$autoload​​ ] )

3、interface_exists();//检查接口是否已定义

bool ​interface_exists​ ( string ​​$interface_name​​ [, bool ​​$autoload​​ ] )

4、method_exists() ;// 检查类的方法是否存在

bool ​method_exists​ ( object ​​$object​​ , string ​​$method_name​​ )

5、property_exists() ;检查对象或类是否具有该属性

bool ​property_exists​ ( mixed​ ​​$class​​ , string ​​$property​​ )




举报

相关推荐

0 条评论