PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

ReflectionClass::__construct - ReflectionClass を作成する | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

ReflectionClass::__construct

(PHP 5, PHP 7)

ReflectionClass::__constructReflectionClass を作成する

説明

public ReflectionClass::__construct ( mixed $argument )

新しい ReflectionClass オブジェクトを作成します。

パラメータ

argument

調べたいクラスのクラス名をあらわす文字列か、そのクラスのオブジェクト。

返り値

Returns constructed ReflectionClass instance.

エラー / 例外

Throws ReflectionException if the class to reflect does not exist.

例1 ReflectionClass の基本的な使用例

<?php
Reflection
::export(new ReflectionClass('Exception'));
?>

上の例の出力は、 たとえば以下のようになります。

Class [ <internal:Core> class Exception ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [7] {
    Property [ <default> protected $message ]
    Property [ <default> private $string ]
    Property [ <default> protected $code ]
    Property [ <default> protected $file ]
    Property [ <default> protected $line ]
    Property [ <default> private $trace ]
    Property [ <default> private $previous ]
  }

  - Methods [10] {
    Method [ <internal:Core> final private method __clone ] {
    }

    Method [ <internal:Core, ctor> public method __construct ] {

      - Parameters [3] {
        Parameter #0 [ <optional> $message ]
        Parameter #1 [ <optional> $code ]
        Parameter #2 [ <optional> $previous ]
      }
    }

    Method [ <internal:Core> final public method getMessage ] {
    }

    Method [ <internal:Core> final public method getCode ] {
    }

    Method [ <internal:Core> final public method getFile ] {
    }

    Method [ <internal:Core> final public method getLine ] {
    }

    Method [ <internal:Core> final public method getTrace ] {
    }

    Method [ <internal:Core> final public method getPrevious ] {
    }

    Method [ <internal:Core> final public method getTraceAsString ] {
    }

    Method [ <internal:Core> public method __toString ] {
    }
  }
}

参考


忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「ReflectionClass::__construct - ReflectionClass を作成する」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | ReflectionClass::__construct - ReflectionClass を作成する」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: