In the smarty template, if you want to use the php function in the displayed information, if there is only one parameter function, for example, the trim that goes to the blank space, it will be written as sample1.
The code is as follows:
<{$ Colname | trim}>
How can I write a function with three parameters like iconv? If it is written:
Sample 2
The code is as follows:
<{$ Colname | iconv: 'utf-8': 'gbk'}>
An error message is displayed upon execution.
Therefore, we will find that, starting from the usage of the functions applied on the smarty template page, in smaple 1, $ Row-> colname in front of trim is actually the first parameter of trim, use | in the middle to concatenate;
If you want to use a function with three parameters like iconv, you must write it as follows:
Sample 3
The code is as follows:
<{'Utf-8' | iconv: 'gbk': $ colname}>
That is
The first parameter of the function | function: the second parameter: the third parameter. In sample 3, the colname value is converted from UTF-8 to gbk.