Key dynamically created member variables a very strange question about

Source: Internet
Author: User
Key dynamically created member variables a very strange question.
This post was last edited by lytreo650 on 2014-06-20 10:22:34

Using TP to do the project, the parent class dynamically creates a member variable, and then I randomly print something like this in the subclass dump ($this-$GFRGRR) can print out all dynamically created member variables, $GFRGRR is an undeclared variable. The printed thing is a large array, and each member variable is an element of the array. Another example is the dynamically created member variable has an element is $this->cert, then I $ A = ' cert ', in the printing $this-> $a, will still print out all the dynamically created member variables, I ask you why this? Is the TP action doing some expansion? Because it is the company's project inconvenient to stick out the source code, can we give a thought? Thank you!
------Solution--------------------
The parent class dynamically creates what type of member variable it is, and if it is private it will not output.
------Solution--------------------
It is not clear that the default is public and that it is normal to be able to adjust.

If you don't want to use it externally, you can write it as a protected/private, if the sub-category is not. It's good to use private directly.

  • 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.