PHPReflectionClass, phpreflectionclass_PHP tutorial

Source: Internet
Author: User
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 = '...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.