The usage of the output Defined tag determined by the ThinkPHP template is described in detail. The defined tag of the ThinkPHP template engine is used to determine whether a constant has been defined. The defined tag of ThinkPHP is used to determine whether a constant has been defined. its function is equivalent to the defined tag of the defin ThinkPHP template engine in PHP.
Determine whether a constant has been defined.
The defined tag of ThinkPHP is used to determine whether a constant has been defined. its function
Equivalent to the defined () function in PHP. The usage of the defined label is as follows:
Content to be output
Define a constant in a module operation (such as Index/display) and output the template:
Define ("SITE_NAME", ""); $ this-> display ();
Use the defined tag in the template/Tpl/default/Index/display.html as follows:
Website name: {* SITE_NAME}
Running this example will output:
Website name: Script home
The equivalent php code in this example is as follows:
<? Phpif (defined ("SITE_NAME") {echo 'website name: ', constant ("SITE_NAME") ;}?>
If the judgment is not defined, you can use:
{* SITE_NAME} does not exist and is undefined.
The preceding two examples are merged as follows:
Website name: {* SITE_NAME}
{* SITE_NAME} does not exist and is undefined.
Struct determines whether a constant has been defined. The defined tag of ThinkPHP is used to determine whether a constant has been defined. its function is equivalent to defin...