If I use magic methods. While using reflection API, I can't investigate class properties.. Why is it so?
EDIT
What is Reflection API? pls do not refer me php.net i didnt understood that.. guide me in your words plsss
If I use magic methods. While using reflection API, I can't investigate class properties.. Why is it so?
EDIT
What is Reflection API? pls do not refer me php.net i didnt understood that.. guide me in your words plsss
マジックメソッドを使用してプロパティにアクセスすると、これらのプロパティは通常、クラスの定義には存在しません。
クラスの定義は通常、次のようになります。
class MyClass {
private $data;
public function __get($name) {
return $this->data[$name];
}
public function __set($name, $value) {
$this->data[$name] = $value;
}
}
実際のプロパティ
は存在しない$data
ため(マジックメソッドによってビッグデータストアとして使用される配列のみに存在します) __get
、__set
それらはReflectionAPIでは表示できません。
これは、魔法のメソッドを使用することによって引き起こされる問題の1つです。これらは、そこにないプロパティ(またはメソッド__call
)にアクセスするために使用されます。ReflectionAPIは、そこにあるものしか見ることができません。