ReflectionClass::getConstructor

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getConstructor獲取類的構(gòu)造函數(shù)

說明

public ReflectionClass::getConstructor(): ReflectionMethod

獲取已反射的類的構(gòu)造函數(shù)。

參數(shù)

此函數(shù)沒有參數(shù)。

返回值

一個(gè) ReflectionMethod 對(duì)象,反射了類的構(gòu)造函數(shù),或者當(dāng)類不存在構(gòu)造函數(shù)時(shí)返回 null。

范例

示例 #1 ReflectionClass::getConstructor() 的基本用法

<?php
$class 
= new ReflectionClass('ReflectionClass');
$constructor $class->getConstructor();
var_dump($constructor);
?>

以上例程會(huì)輸出:

object(ReflectionMethod)#2 (2) {
  ["name"]=>
  string(11) "__construct"
  ["class"]=>
  string(15) "ReflectionClass"
}

參見

  • <tfoot id="ztd8x"><wbr id="ztd8x"><small id="ztd8x"></small></wbr></tfoot>
    <var id="ztd8x"></var>
    <form id="ztd8x"><tr id="ztd8x"></tr></form>
      <li id="ztd8x"><delect id="ztd8x"><sup id="ztd8x"></sup></delect></li>
      <table id="ztd8x"><em id="ztd8x"></em></table>
      <code id="ztd8x"></code>