$_get <{$smarty .get}>
$_post <{$smarty .post}>
$_cookie <{$smarty .cookie}>
$_session <{$smarty .session}>
$_files (because the foreground is not available)
$_server <{$smarty .server}>
$_request <{$smarty .request}>
$_env <{$smarty .env}>
$GLOBALS No
Using the request variable in the Smarty template engine, you can request data directly without having to receive and redistribute from PHP
Example:
| The code is as follows |
Copy Code |
<{$smarty .get}> PHP Way: $tpl->assign ("id", $_get[' id '); <{$id}> |
Smarty Request Variable mode: <{$smarty .get.id}>
2. <{$smarty .session}>
PHP Way: $_session[' name ']= "Marcofly";
| The code is as follows |
Copy Code |
$tpl->assign ("name", $_session[' name '); <{$name}>// |
Output to Template
Smarty Request Variable mode:
| The code is as follows |
Copy Code |
<{$smarty .session.name}> |
Smarty the retention variable in the template engine <{$smarty}>:
<{$smarty .const}> can pass "." Access to any one of the constants (including custom and system constants)
Example:
| The code is as follows |
Copy Code |
<{$smarty .const.__file__}> Define ("PI", 3.1415926); Defining PHP Constants <{$smarty .const.pi}>//using Smarty Output constant PI |
Smarty access to configuration files in two ways
| The code is as follows |
Copy Code |
Way a:<{##}> Mode two: <{$smarty .config}>//retention variable form |
Get the current server time:
You do not need to use PHP to get time from the server, simply use the Smarty retention variable to get
| code is as follows |
copy code |
| <{$ Smarty.now|date_format: "%y-%m-%d%h:%m:%s"}> |