Home  >  Article  >  Backend Development  >  Usage analysis of smarty built-in function capture, smartycapture_PHP tutorial

Usage analysis of smarty built-in function capture, smartycapture_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:09:12869browse

Usage analysis of smarty built-in function capture, smartycapture

The example in this article describes the usage of smarty’s built-in function capture. Share it with everyone for your reference. The specific analysis is as follows:

{capture} can capture the output content within the tag range and store it in a variable without displaying it. There are three ways to use it,
The code is as follows:

Copy code The code is as follows:
{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}

The first one: {capture} uses the name attribute;
The second type: {capture} captures content into variables;
The third type: {capture} captures the content into an array variable.

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/946754.htmlTechArticleSmarty built-in function capture usage analysis, smartycapture This article describes the usage of smarty built-in function capture with examples. Share it with everyone for your reference. The specific analysis is as follows: {capture} can capture...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn