There are many ways to invoke the session data in the templates of the thinkphp framework, which can be used flexibly according to the situation, and the following categories are common:
1. Call {$Think. session} directly in the template to get the session;
2. In <php></php> tags directly to write PHP code to invoke $_session data;
3. Write <?php in the template, and then directly write PHP code inside to invoke $_session;
4. In action, the $_session variable is assigned to the template by the Assign () method;
5. In the Custom function library, create a new function to return the $_session variable, and then use the {$ variable | 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 5 methods, readers can also develop new calling methods according to their own preferences.
More interested in thinkphp related content readers can view the site topics: "thinkphp Introductory Course", "thinkphp Template Operation Skills Summary", "thinkphp Common Methods Summary", "Smarty Template Introductory Course" and "PHP template technology Summary."
I hope this article will help you with the PHP program design based on thinkphp framework.