首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ReflectionClass::getProperty

(PHP 5, PHP 7)

ReflectionClass::getProperty - 为类的属性获取ReflectionProperty

描述

代码语言:javascript
复制
public ReflectionProperty ReflectionClass::getProperty ( string $name )

获取类的属性的ReflectionProperty。

参数

name

属性名称。

返回值

一个ReflectionProperty。

例子

Example#1 ReflectionClass::getProperty()的基本用法

代码语言:javascript
复制
<?php
$class?=?new?ReflectionClass('ReflectionClass');
$property?=?$class->getProperty('name');
var_dump($property);
?>

上面的例子将输出:

代码语言:javascript
复制
object(ReflectionProperty)#2 (2) {
  ["name"]=>
  string(4) "name"
  ["class"]=>
  string(15) "ReflectionClass"
}

另请参阅

  • ReflectionClass::getProperties() - 获取属性

← ReflectionClass::getProperties

ReflectionClass::getReflectionConstant →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com