smarty capture使用
生活随笔
收集整理的這篇文章主要介紹了
smarty capture使用
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
smarty內(nèi)置函數(shù)capture用法分析
{capture}可以捕獲標記范圍內(nèi)的輸出內(nèi)容,并存到變量中而不顯示。有三種用法,
代碼如下:
復制代碼 代碼如下:
{capture name="banner"}aaaaaa{/capture}
{$smarty.capture.banner}
{capture assign="foo"}bbbbbb{/capture}
{$foo}
{capture append="arr"}hello{/capture}
{capture append="arr"}world{/capture}
{foreach $arr as $value}
{$value}
{/foreach}
?
第一種:{capture}使用name屬性;
第二種:{capture}捕獲內(nèi)容到變量;
第三種:{capture}捕獲內(nèi)容到數(shù)組變量。
轉載自 http://www.php.cn/php-notebook-167408.html
?
補充,看了下手冊,name是必須的屬性,上面的寫法估計不嚴謹,簡單記錄一下吧。
總結
以上是生活随笔為你收集整理的smarty capture使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 企业邮箱Foxmail提示错误421 t
- 下一篇: Zhong__Centos8安装dock