首頁  >  文章  >  後端開發  >  thinkphp_模版操作_PHP教程

thinkphp_模版操作_PHP教程

WBOY
WBOY原創
2016-07-13 10:29:11782瀏覽

快捷输出变量

{:<span>function</span>(&hellip;)} <span>//</span><span>执行方法并输出返回值</span>
{~<span>function</span>} <span>//</span><span>执行方法不输出</span>
{@<span>var</span>} <span>//</span><span>输出Session变量</span>
{<span>#</span><span>var} //输出Cookie变量</span>
{&<span>var</span>} <span>//</span><span>输出配置参数  </span>
{%<span>var</span>} <span>//</span><span>输出语言变量</span>
{.<span>var</span>} <span>//</span><span>输出GET变量</span>
{^<span>var</span>} <span>//</span><span>输出POST变量</span>
{*<span>var</span>} <span>//</span><span>输出常量</span>

 模版输出

<span>//</span><span>1 直接调用index操作模板</span>
<span>$this</span>-><span>display();
</span><span>//</span><span> 对应Myapp/Tpl/default/Index/index.html
//2 调用Index模块的test1操作模板</span>
<span>$this</span>->display('test1'<span>);
</span><span>//</span><span>对应Myapp/Tpl/default/Index/test1.html
//2 调用Message模块的test2操作模板()</span>
<span>$this</span>->display('Message:test2'<span>);
</span><span>//</span><span>对应Myapp/Tpl/default/Message/test2.html
//3 调用XP主题的Message模块的test2操作模板</span>
<span>$this</span>->display('Xp@Message:test2'<span>);
</span><span>//</span><span>对应Myapp/Tpl/Xp/Message/test2.html
//4 直接指定模板文件的全名</span>
<span>$this</span>->display('../Message/test3.html'<span>);
</span><span>//</span><span>对应Myapp/Tpl/default/Message/test3.html</span>

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/778218.htmlTechArticle快捷输出变量 {: function ()} // 执行方法并输出返回值 {~ function } // 执行方法不输出 {@ var } // 输出Session变量 { # var} //输出Cookie变量 { var } //...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn