Home > Backend Development > PHP Tutorial > Smarty reserved variable usage analysis, smarty variable usage_PHP tutorial

Smarty reserved variable usage analysis, smarty variable usage_PHP tutorial

WBOY
Release: 2016-07-12 08:50:38
Original
811 people have browsed it

Smarty reserved variable usage analysis, smarty variable usage

The examples in this article describe the usage of Smarty reserved variables. Share it with everyone for your reference, the details are as follows:

The {$smarty} variable does not need to be allocated. It can be used directly in the template to access some special template variables. There are many variables, such as: page request variables $_GET, $_POST, $_REQUEST, $_SESSION, $ _COOKIE, and some environment variables such as $_ENV and $_SERVER, which can be obtained directly through the following methods:

{$smarty.get}

Copy after login

Same as $_GET to get url parameters

For example: $_GET['page'] Get

through {$smarty.get.page}
{$smarty.post}

Copy after login

Same as $_POST to get parameters

{$smarty.request}

Copy after login

Same as $_REQUEST to get request parameters

{$smarty.cookie}

Copy after login

Same as $_COOKIE to get cookies

{$smarty.session}

Copy after login

Same as $_SESSION to get session

{$smarty.server}

Copy after login

Same as $_SERVER to get server variables

{$smarty.env}

Copy after login

Same as $_ENV to get environment variables

{$smarty.now}

Copy after login

Same as time(), get timestamp

{$smarty.const}

Copy after login

Directly access PHP constants, such as {$smarty.const.__FILE__}

{$smarty.capture}

Copy after login

Template output captured via the built-in {capture}...{/capture} function can be accessed by {$smarty.capture.name}

{$smarty.section} {$smarty.foreach}

Copy after login

Used to access the loop attributes of {section} and {foreach} respectively. There are some first, last, index and other attribute values ​​​​available

{$smarty.template}

Copy after login

Return the current template name

{$smarty.version}

Copy after login

smarty version

{$smarty.ldelim} {$smarty.rdelim}

Copy after login

is used to print the left delimiter and right delimiter, class {ldelim}{rdelim}

Readers who are interested in more Smarty-related content can check out the special topics on this site: "Basic Tutorial for Getting Started with Smarty Templates", "Summary of PHP Template Technology", "Summary of PHP Database Operation Skills Based on PDO", "PHP Operations and Operators" Usage summary", "PHP network programming skills summary", "PHP basic syntax introductory tutorial", "php object-oriented programming introductory tutorial", "php string (string) usage summary", "php mysql database operation introductory tutorial" and "Summary of Common Database Operation Skills in PHP"

I hope this article will be helpful to everyone’s PHP program design based on smarty templates.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1133099.htmlTechArticleSmarty retained variable usage analysis, smarty variable usage This article describes the usage of Smarty retained variables with examples. Share it with everyone for your reference, the details are as follows: The {$smarty} variable does not need to be allocated, it...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template