ReflectionClass::export

(PHP 5, PHP 7)

ReflectionClass::export锟斤拷锟斤拷一锟斤拷锟斤拷

说锟斤拷

public static ReflectionClass::export ( mixed $argument [, bool $return = false ] ) : string

锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟洁。

锟斤拷锟斤拷

argument

锟斤拷锟斤拷锟侥凤拷锟戒。

return

锟斤拷为 TRUE 时锟斤拷锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿� FALSE锟斤拷默锟斤拷值锟斤拷锟斤拷锟斤拷苑锟斤拷亍锟�

锟斤拷锟斤拷值

锟斤拷锟斤拷锟斤拷锟� return 锟斤拷为 TRUE锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿� string 锟斤拷锟截o拷锟斤拷锟津返伙拷 NULL锟斤拷

锟斤拷锟斤拷

Example #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
    }
  }
}

锟轿硷拷