Heim  >  Artikel  >  Backend-Entwicklung  >  在smarty模板中使用PHP函数的方法_php模板

在smarty模板中使用PHP函数的方法_php模板

WBOY
WBOYOriginal
2016-05-17 09:20:00872Durchsuche

sample1

复制代码 代码如下:



那如果使用像iconv这样的有三个参数的函数该怎么写呢?如果写成:
sample 2
复制代码 代码如下:



一执行就会发现显示error信息。
因此研究一下就会发现,起始在smarty模板页的套用函数用法中,以smaple 1来说,trim的前面$Row->colname其实就是trim的第一个参数,中间用|这个符号串接;
那假设要使用像iconv有三个参数的函数的话,就要写成:
sample 3
复制代码 代码如下:



也就是
函数第一个参数|函数:第二个参数:第三个参数。sample 3中会把colname的值从utf-8格式转换成gbk。
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn