Home > Backend Development > PHP Tutorial > How to call session data in ThinkPHP template_PHP tutorial

How to call session data in ThinkPHP template_PHP tutorial

WBOY
Release: 2016-07-13 10:26:27
Original
836 people have browsed it

There are many ways to call session data in the template of the ThinkPHP framework, which can be used flexibly according to the situation. The common ones include the following categories:

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

2. Directly write php code in the tag to call the $_SESSION data;

3. Write in the template, and then directly write php code in it to call $_SESSION;

4. In Action, assign the $_SESSION variable to the template through the assign() method;

5. In the custom function library, create a new function to return the $_SESSION variable, and then use {$variable name | function name} in the template file to assign the $_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 own preferences.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824684.htmlTechArticleThere are many ways to call session data in the template of the ThinkPHP framework, which can be used flexibly according to the situation. Common ones are as follows Several categories: 1. Directly call {$Think.session} in the template to obtain sessi...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template