ThinkPHP_5系统原生标签,变量输出

获取系统变量
  {$Think.service.HTTP_HOST}
  {$Think.env.PHP_STATUS}
  {$Think.session.email}
  {$Think.cookie.name}

  {$Think.get.id}
  {$Think.request.id}
  {$Think.post.sid}

  {$Think.const.APP_PATH}
  {$Think.APP_PATH}


模板变量

[函数运用] 【管道符】
  {$email}:{$email|md5}
  {$email}:{$email|substr=0,8}
  {$email}:{$email|substr=###,0,8}
  {$time}:{$time|date="Y-m-d",###}

  substr($obj,0,3);
  md5($obj);
  date('Y-m-d',time());

[计算]

  <body>
    <h1>这是view/index/index.html</h1>
    //Controller由assign()的时候
    <p>a+b={$a+$b}</p>
    <p>{++$a}</p>
    <p>{--$a}</p>
    //Controller无assign的时候,可以设默认值
    {$email|default="25478@qq.com"}
  </body>

[原样输出]【literal标签】
  <p>
    {literal}
    {$email}
    {/literal}
  </p>

[模板注释]
  {/*这里是view的注释*/}

posted @ 2017-07-05 09:41  高锴  阅读(1742)  评论(0编辑  收藏  举报