sample1
Copy the code The code is as follows:
<{$colname|trim}>
How to write a function with three parameters like iconv? If it is written as:
sample 2
Copy the code The code is as follows:
<{$colname|iconv:'utf-8':'gbk'}>
Once executed, an error will be displayed information.
So 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, the $Row->colname in front of trim is actually the first parameter of trim, and the symbol string | is used in the middle.
If you want to use a function like iconv with three parameters, you need to write:
sample 3
Copy the code The code is as follows:
<{'utf-8'|iconv:'gbk ':$colname}>
is the first parameter of
function | function: second parameter: third parameter. In sample 3, the value of colname will be converted from utf-8 format to gbk.
The above introduces the smarty manual method of using PHP functions in smarty templates, including the content of smarty manual. I hope it will be helpful to friends who are interested in PHP tutorials.