thinkphp Development Notes-View

Source: Internet
Author: User

1, if you want to output the variable in the template, you must pass the variable to the template in the controller, the system provides the Assign method to assign a value to the template variable, regardless of what type of variable is uniformly used assign assignment, and the Assign method must be called before the display and the Show method.

$array ['name']    ='thinkphp'; $array ['Email']   ='[email protected]'; $array ['Phone']   ='12335678';$ This-assign ($array); $ This->display ();

You can then output the name, email, and phone three variables in the template file:

<?php Echo $name. ' ['. $email. ". $phone. ' ]';? >

2. render output does not need to write the path and suffix of the template file, to be precise, the controller and operation does not necessarily need to have the actual corresponding controller and operation, just a directory name and file name, for example, your project may not have a public controller at all, There is no menu operation for the public controller, but it can be used as well:

$This->display ('public:menu');

3. Continuous ...

thinkphp Development Notes-View

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.