Summary of thinkphp template output skills
- 2021-08-05 09:17:48
- OfStack
This paper summarizes the output skills of thinkphp template with examples. Share it for your reference. The specific summary is as follows:
1. Variable output (key points)
1. Scalar output:
{$name}
2. Array output
{$name[0]}
{$name['k2']}
{$name.k1}
3. Object output
{$name:k}// Call the member properties of this object K
{$name->k}// Traditional invocation K Method
2. System variables
{$Think.get.id}// Call the system variable in the template to get the provided id Value
3. Use functions
{$name|strtoupper} The generated compiled file is
{$name|date='Y m d H:i:s',###}// Whole # It means point, representing the previous variable $name
4. Default values
{$name|default=' This is the default value '}// If the value does not exist, use the default value
5. Operators
// Common operators: + - * / % ++ --
{$name+1}
I hope this article is helpful to everyone's ThinkPHP framework programming.