Method for calling session data in the ThinkPHP template _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
The ThinkPHP template calls the session data method. There are many methods to call session data in the ThinkPHP framework template, which can be used flexibly as needed. The following are common methods: 1. directly call {$ Think in the template. session} There are many methods to call session data in the template for getting sessi ThinkPHP framework, which can be used flexibly as needed. The following are common methods:

1. call {$ Think. session} in the template to obtain the session;

2. in Tag directly write php code to call $ _ SESSION data;

3. write in the template <? Php?>, Then, directly write php code in it to call $ _ SESSION;

4. assign the $ _ SESSION variable to the template through The assign () method in the Action;

5. in the custom function library, create a new function to return the $ _ SESSION variable, then, use {$ variable life | function name} in the template file to assign $ _ SESSION returned by the function to a variable in the template.

In addition to the above five methods, readers can also develop new calling methods according to their preferences.

Sequence 1. in the template, call {$ Think. session} directly to obtain sessi...

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.