Get the App
SLTechnology News&Howtos  ›  Development  › 

Summary of skills for thinkphp template output

Shulou Source: shulou.com Published: 2022-06-03 19:04:00 11月12日 Update

This article introduces the relevant knowledge of "skills Summary of thinkphp template output". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Variable output (key points)

1. Scalar output:

The copy code is as follows:

{$name}

two。 Array output

The copy code is as follows:

{$name [0]}

{$name ['k2']}

{$name.k1}

3. Object output

The copy code is as follows:

{$name:k} / / call the member property K of this object

{$name- > k} / / traditional call K method

II. System variables

The copy code is as follows:

{$Think.get.id} / / call the system variable in the template to get the id value provided

Third, use functions

The copy code is as follows:

The compiled file generated by {$name | strtoupper} is

{$name | date='Y m d Hlav iRu swatches #} / / the whole # means the dot and represents the previous variable $name

4. Default value

The copy code is as follows:

{$name | default=' here is the default value'} / / if the value does not exist, use the default value

5. Operator

The copy code is as follows:

/ / Common operators: +-* /% +--

{$name+1}

This is the end of the summary of thinkphp template output skills. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Code output variables templates techniques content objects more knowledge systems operators operations utility learning and then representatives traditions functions dilemmas reality. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Microsoft Apple MariaDB Shulou Tech Info