thinkphp a,r,m,d Method Difference _php Tutorial

Source: Internet
Author: User

A,r,m,d method Difference of thinkphp


In thinkphp, there are several ways to instantiate an object, if it is a class, there is a and R methods, the difference is that the A method is only an instantiation of the object, and the R method can be instantiated at the same time the method inside the object, where you need to specify, such as the following instance code:

 
  Test1 (); echo "";//You can also go across modules call $test_m=a ("Home/goods"), Echo $test _m->test (); echo "",//r method can take execution of the corresponding module R ("Home/goods /test ");//$this->display ();}}

As can be seen from the above, the R method can also be used to cross-module to instantiate.

In addition, in model data models, it is necessary to use the following two methods, one is the D method, one is the M method, the former is the instantiation of the data model class, and the latter is the parent class of the instantiated data model.

 
  Select (); echo "
"; Var_dump ($mythinkphp->select ()); echo count ($t); echo ""; echo Count ($t [1]); echo ""; for ($i =0; $i
 
  
   
  Although there is no difference from usage, the D method instantiates only the defined data model class, and the M method instantiates the parent class of the data model.
  
   

http://www.bkjia.com/PHPjc/992669.html www.bkjia.com true http://www.bkjia.com/PHPjc/992669.html techarticle thinkphp The A,r,m,d method differs in thinkphp, there are several ways to instantiate an object, if it is a class, there is a and R methods, the difference is that a method is just an instantiation of the object, and the R method is available ...

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