PHPReflectionClass, phpreflectionclass. PHPReflectionClass, phpreflectionclass1? Php2 ** 3 * @ desctestreflectionclass4 * @ authorsongweiqing5 * @ create_time2015-01-76 * 7*8 classTest {9 public $ attr1 PHP ReflectionClass, phpreflectionclass
1 Attr1; 22} 23 // get the property 224 protected function getAttr2 () {25 26 echo $ this-> attr2; 27} 28/** 29 * @ desc get attribute 330 * @ return string 31 */32 private function getAttr3 () {33 echo $ this-> attr3; 34} 35 36 public static function getAttr5 () {37 echo self: $ attr5; 38} 39} 40 41 $ reflection = new ReflectionClass ('test '); 42 // var_dump ($ reflection-> getName (); // get the class name getName (); 43 // var_dump ($ reflection-> getConstant ("ATTR4 ")); // Obtain the specified constant name 44 // var_dump ($ reflection-> getConstants ()); // get a set of constants named 45 // var_dump ($ reflection-> getConstructor (); // Obtain the constructor, no constructor returns null46 // var_dump ($ reflection-> getDefaultProperties (); // gets the default attribute, constant attributes do not include 47 // var_dump ($ reflection-> getDocComment (); // gets comments for this class. for comments in Sino-French classes, ignore them, no false48 // var_dump ($ reflection-> getEndLine () is returned; // The number of rows in the last row in the class is 49 // var_dump ($ reflection-> getFileName ()); // Obtain the class name of the definition class 50 // var_dump ($ reflection-> getMethods ()); // Obtain methods 51 in all classes // var_dump ($ reflection-> getProperties (); // Obtain all attributes, does not contain constant attributes 52 // $ instance = $ reflection-> newInstanceArgs (); // instantiate the reflected class 53 // $ instance = $ reflection-> newInstance ('test'); instantiate the specified classView Code
Http://www.bkjia.com/PHPjc/939251.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/939251.htmlTechArticlePHP ReflectionClass, phpreflectionclass 1? Php 2/*** @ desc test reflectionclass 4 * @ author songweiqing 5 * @ create_time 2015-01-7 6*7 */8 class Test {9 public $ attr1 = '...