Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of skills for thinkphp template output

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report