~~~
$phpsciter?=?newphpsciter();
//?print\_r(\[
//?????'version'=>$phpsciter->getVersion(),
//?????'PHPSciterVersion'=>$phpsciter->getPHPSciterVersion(),
//?\]);
//?$objClass?=?new?\\ReflectionClass('phpsciter');
//?print\_r($objClass->getConstants());
//實例化反射API獲取類名
$obj?=?newReflectionObject($phpsciter);
$class\_name?=?$obj\->getName();
$method\_arr?=?$props\_arr?=?array();
//獲取對象的屬性列表
$props?=?$obj\->getProperties();
foreach?($props?as?$key\_p?=>?$value\_p)?{
$props\_arr\[$value\_p\->getName()\]?=?$value\_p;
}
//獲取對象的方法列表
$method?=?$obj\->getMethods();
foreach?($method?as?$key\_m?=>?$value\_m)?{
$method\_arr\[$value\_m\->getName()\]?=?$value\_m;
}
//格式化輸出類的屬性以及方法
echo"class?$class\_name?{?\\n";
is\_array($props\_arr)?&&?ksort($props\_arr);
foreach?($props\_arr?as?$key\_o?=>?$value\_o)?{
echo"\\t";
echo$value\_o\->isPublic()???'public'?:?'?'?,$value\_o\->isPrivate()???'private'?:?'?'?,$value\_o\->isProtected()???'protected'?:?'?'?,$value\_o\->isStatic()???'static'?:?'?';
echo"\\t$value\_o\\n";
}
echo"\\n";
is\_array($method\_arr)?&&?ksort($method\_arr);
foreach?($method\_arr?as?$key\_e?=>?$value\_e)?{
echo"\\t";
echo$value\_e\->isPublic()???'public'?:?'?'?,$value\_e\->isPrivate()???'private'?:?'?'?,$value\_e\->isProtected()???'protected'?:?'?';
echo"\\tfunction?$value\_e?()?{}?\\n";
}
echo'}';
~~~
得出的結果:
~~~
class phpsciter {
protected Property [ <default> protected $frame_bottom ]
protected Property [ <default> protected $frame_left ]
protected Property [ <default> protected $frame_right ]
protected Property [ <default> protected $frame_top ]
public Property [ <implicit> public $load_file ]
public Property [ <implicit> public $load_html ]
private Property [ <default> private $option ]
private Property [ <default> private $option_value ]
protected Property [ <default> protected $resource_path ]
public Property [ <implicit> public $title ]
private function Method [ <internal:PHPSciter> private method __clone ] {
}
() {}
public function Method [ <internal:PHPSciter, ctor> public method __construct ] {
}
() {}
public function Method [ <internal:PHPSciter, dtor> public method __destruct ] {
}
() {}
private function Method [ <internal:PHPSciter> private method __sleep ] {
}
() {}
private function Method [ <internal:PHPSciter> private method __wakeup ] {
}
() {}
public function Method [ <internal:PHPSciter> static public method defineFunction ] {
- Parameters [2] {
Parameter #0 [ <required> $event_name ]
Parameter #1 [ <required> $function_name ]
}
}
() {}
public function Method [ <internal:PHPSciter> public method getPHPSciterVersion ] {
}
() {}
public function Method [ <internal:PHPSciter> public method getVersion ] {
}
() {}
public function Method [ <internal:PHPSciter> static public method ifDefined ] {
- Parameters [1] {
Parameter #0 [ <required> $event_name ]
}
}
() {}
public function Method [ <internal:PHPSciter> public method loadFile ] {
- Parameters [1] {
Parameter #0 [ <required> $file_name ]
}
}
() {}
public function Method [ <internal:PHPSciter> public method loadHtml ] {
- Parameters [1] {
Parameter #0 [ <required> $html ]
}
}
() {}
public function Method [ <internal:PHPSciter> public method loadPHP ] {
- Parameters [1] {
Parameter #0 [ <required> $php ]
}
}
() {}
public function Method [ <internal:PHPSciter> public method run ] {
}
() {}
public function Method [ <internal:PHPSciter> public method setOption ] {
}
() {}
public function Method [ <internal:PHPSciter> public method setResourcePath ] {
- Parameters [1] {
Parameter #0 [ <required> $resource_path ]
}
}
() {}
public function Method [ <internal:PHPSciter> public method setWindowFrame ] {
- Parameters [4] {
Parameter #0 [ <required> $frame_top ]
Parameter #1 [ <required> $frame_left ]
Parameter #2 [ <required> $frame_right ]
Parameter #3 [ <required> $frame_bottom ]
}
}
() {}
public function Method [ <internal:PHPSciter> public method setWindowTitle ] {
- Parameters [1] {
Parameter #0 [ <required> $title ]
}
}
() {}
}
~~~