How to use PHP functions in smarty templates_PHP tutorial

WBOY
Release: 2016-07-21 15:30:12
Original
1023 people have browsed it

sample1

Copy code The code is as follows:

<{$colname|trim}>

How to write if you use a function with three parameters like iconv? If written as:
sample 2
Copy code The code is as follows:

<{$colname|iconv:'utf -8':'gbk'}>

Once executed, an error message will be displayed.
Therefore, if you study it, you will find that starting from the application function usage on the smarty template page, taking smaple 1 as an example, $Row->colname in front of trim is actually the first parameter of trim, and | is used in the middle Symbol concatenation;
If you want to use a function like iconv with three parameters, you must write:
sample 3
Copy code Code As follows:

<{'utf-8'|iconv:'gbk':$colname}>

is the first parameter of the
function |Function: second parameter: third parameter. In sample 3, the value of colname will be converted from utf-8 format to gbk.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323258.htmlTechArticlesample1 Copy the code as follows: {$colname|trim} Then if you use a function with three parameters like iconv How to write it? If written as: sample 2 Copy the code The code is as follows: {$co...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!