php常见的判断函数

时间:2022-05-08
本文章向大家介绍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 )