Home > Article > Backend Development > Summary of pre-reserved variables in php smarty
The following is an example of accessing page request variables such as get, post, cookies, server, environment and session variables. For example, {$smarty.server.SERVER_NAME} obtains server variables, {$smarty.env.PATH} obtains system environment variables path, { $smarty.request.username} obtains the composite variable of get/post/cookies/server/env.
{$smarty.now} variable is used to access the current timestamp.
You can use the date_format adjuster to format the output. For example {$smarty.now|date_format:"%Y-%m-%d %H:%M:% S"}
{$smarty.const}
You can directly access PHP constants. For example, {$smarty.const._MY_CONST_VAL}
{$smarty.capture}
The output can be captured through the {capture}..{/capture} structure It can be accessed using the {$smarty} variable.
{$smarty.config}
{$smarty} variable can access the loaded config variable.
For example, {$smarty.config.foo} can represent {#foo#}.
{$smarty.section}, {$smarty.foreach}
{$smarty} variables can access the properties of the 'section' and 'foreach' loops.
{$smarty.template}
Displays the name of the template currently being processed.
{$smarty.version}
Show the smarty template version
{$smarty.ldelim}
Show the left delimiter
{$smarty.rdelim}
Show the right delimiter
The above has introduced a summary of PHP smarty's pre-reserved variables, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.