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