Use PHP functions in the smarty template. Sample 1 copies the code as follows: {$ colname | trim}. how can I write a function with three parameters like iconv? If the code is: sample2, copy the code as follows: {$ co 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.
The http://www.bkjia.com/PHPjc/323258.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323258.htmlTechArticlesample1 code is as follows: {$ colname | trim}, if you use a function with three parameters like iconv, how do you write it? Sample 2 code: {$ co...