{capture编程客栈}可以捕获标记范围内的输出内容,并存到变量中而不显示。有三种用法,
代码如下:
复制代码 代码如下:
{capture name="banner"}aaaaaa{/capture}
{$smarty.capture.banner}
<hr />www.cppcns.com
{capture assign="foo"}bbbbbb{/capture}
{$foo}
<hr />
{capture append="arr"}hello{/capture}
{capture append="arr"}world{/capture}
{编程客栈foreach $arr as $value}
{$value}
{/foreacyAznXh}
{$smarty.capture.banner}
<hr />www.cppcns.com
{capture assign="foo"}bbbbbb{/capture}
{$foo}
<hr />
{capture append="arr"}hello{/capture}
{capture append="arr"}world{/capture}
{编程客栈foreach $arr as $value}
{$value}
{/foreacyAznXh}
http://www.cppcns.com
希望本文所述对大家的php程序设计有所帮助。
本文标题: smarty内置函数capture用法分析
本文地址: http://www.cppcns.com/wangluo/php/118888.html
© 著作权归作者所有
举报
发表评论
0/200