admin 发表于 2020-11-22 15:15:50

ThinkPHP,六、系统变量的使用,比如server、session、cookie等...


<p class="MsoNormal" align="left"><b><span style="font-size:18.0pt;font-family:彩虹粗仿宋;mso-bidi-font-family:MicrosoftYaHei;
color:#525252;mso-font-kerning:0pt">系统变量输出<span lang="EN-US"><o:p></o:p></span></span></b></p><p class="MsoNormal" align="left"><span style="font-size:12.0pt;font-family:彩虹粗仿宋;
mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">普通的模板变量需要首先赋值后才能在模板中输出,但是系统变量则不需要,可以直接在模板中输出,系统变量<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" align="left"><span style="font-size:12.0pt;font-family:彩虹粗仿宋;
mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">的输出通常以<span lang="EN-US">**{$Think** </span>打头,例如:<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" align="left"><span lang="EN-US" style="font-size:12.0pt;font-family:
彩虹粗仿宋;mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">{$Think.server.script_name}
// </span><span style="font-size:12.0pt;font-family:彩虹粗仿宋;mso-bidi-font-family:
MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">输出<span lang="EN-US">$_SERVER['SCRIPT_NAME']</span>变量<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" align="left"><span lang="EN-US" style="font-size:12.0pt;font-family:
彩虹粗仿宋;mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">{$Think.session.user_id}
// </span><span style="font-size:12.0pt;font-family:彩虹粗仿宋;mso-bidi-font-family:
MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">输出<span lang="EN-US">$_SESSION['user_id']</span>变量<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" align="left"><span lang="EN-US" style="font-size:12.0pt;font-family:
彩虹粗仿宋;mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">{$Think.get.pageNumber}
// </span><span style="font-size:12.0pt;font-family:彩虹粗仿宋;mso-bidi-font-family:
MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">输出<span lang="EN-US">$_GET['pageNumber']</span>变量<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" align="left"><span lang="EN-US" style="font-size:12.0pt;font-family:
彩虹粗仿宋;mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">{$Think.cookie.name}
// </span><span style="font-size:12.0pt;font-family:彩虹粗仿宋;mso-bidi-font-family:
MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">输出<span lang="EN-US">$_COOKIE['name']</span>变量<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" align="left"><span style="font-size:12.0pt;font-family:彩虹粗仿宋;
mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">支持输出<span lang="EN-US"> $_SERVER </span>、<span lang="EN-US">$_ENV </span>、<span lang="EN-US">
$_POST </span>、<span lang="EN-US"> $_GET </span>、<span lang="EN-US"> $_REQUEST </span>、<span lang="EN-US">$_SESSION </span>和<span lang="EN-US"><o:p></o:p></span></span></p><p>















</p><p class="MsoNormal" align="left"><span lang="EN-US" style="font-size:12.0pt;font-family:
彩虹粗仿宋;mso-bidi-font-family:MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">$_COOKIE
</span><span style="font-size:12.0pt;font-family:彩虹粗仿宋;mso-bidi-font-family:
MicrosoftYaHei;color:#525252;mso-font-kerning:0pt">变量。<span lang="EN-US"><o:p></o:p></span></span></p>
页: [1]
查看完整版本: ThinkPHP,六、系统变量的使用,比如server、session、cookie等...