(PHP 5, PHP 7)
ReflectionClass::export — 導(dǎo)出一個類
導(dǎo)出一個反射后的類。
argument導(dǎo)出的反射。
return
設(shè)為 true 時返回導(dǎo)出結(jié)果,設(shè)為 false(默認(rèn)值)則忽略返回。
如果參數(shù) return
設(shè)為 true,導(dǎo)出結(jié)果將作為 string
返回,否則返回 null。
示例 #1 ReflectionClass::export() 的基本用法
<?php
class Apple {
public $var1;
public $var2 = 'Orange';
public function type() {
return 'Apple';
}
}
ReflectionClass::export('Apple');
?>
以上例程的輸出類似于:
Class [ <user> class Apple ] {
@@ php shell code 1-8
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [2] {
Property [ <default> public $var1 ]
Property [ <default> public $var2 ]
}
- Methods [1] {
Method [ <user> public method type ] {
@@ php shell code 5 - 7
}
}
}