property_exists — 检查对象或类是否具有该属性
2017-01-06 10:10
363 查看
bool
property_exists ( mixed
本函数检查给出的
字符串形式的类名或要检查的类的一个对象
属性的名字
Note:
如果此类不是已知类,使用此函数会使用任何已注册的autoloader。
property_exists ( mixed
$class, string
$property)
本函数检查给出的
property是否存在于指定的类中(以及是否能在当前范围内访问)。
参数
class
字符串形式的类名或要检查的类的一个对象
property
属性的名字
返回值
如果该属性存在则返回TRUE,如果不存在则返回
FALSE,出错返回
NULL。
Note:
如果此类不是已知类,使用此函数会使用任何已注册的autoloader。
class myClass { public $mine; private $xpto; static protected $test; static function test() { var_dump(property_exists('myClass', 'xpto')); //true } } var_dump(property_exists('myClass', 'mine')); //true var_dump(property_exists(new myClass, 'mine')); //true var_dump(property_exists('myClass', 'xpto')); //true, as of PHP 5.3.0 var_dump(property_exists('myClass', 'bar')); //false var_dump(property_exists('myClass', 'test')); //true, as of PHP 5.3.0 myClass::test();
相关文章推荐
- PHP property_exists 检查对象或类是否具有该属性
- property_exists 检查对象或类是否具有该属性
- 检查对象或是类中否存在该属性 property_exists
- flex检查对象是否具有某个方法(函数)、属性的最简方法
- javascript下判断一个对象是否具有指定名称的属性的的代码
- $.isEmptyObject():检查对象是否为空(不包含任何属性)。
- JavaScript中hasOwnProperty函数方法是返回一个布尔值,指出一个对象是否具有指定名称的属性。
- 如何检查某个用户是否具有某个权限对象上定义的某种权限
- 如何检查某个用户是否具有某个权限对象上定义的某种权限
- 检查对象属性是否有空值
- 检测对象是否具有某个属性
- 判断JS对象是否具有某种属性
- 判断指定对象的类型中是否具有指定的IBA属性
- 检查某对象是否有某属性
- 如何检查某个用户是否具有某个权限对象上定义的某种权限
- 如何检查某个用户是否具有某个权限对象上定义的某种权限
- android 检查对象属性是否有一个为空
- 判断一个js对象,是否具有某个属性
- javascript下判断一个对象是否具有指定名称的属性的的代码
- 利用反射检查对象属性是否满足正则特