Home >Backend Development >PHP Tutorial >请教一个smarty的自定义函数参数传递问题。

请教一个smarty的自定义函数参数传递问题。

WBOY
WBOYOriginal
2016-06-23 14:19:171049browse

$tpl = new smarty();		$tpl->registerPlugin('function','func','func');		function func($str){			return $str;		}

{{func str='abc'}}


问题:此处的abc我如何才能传入多个变量呢?
情况:比如我页面中已经获取到2个值$a.id = 2和$b.id = 3,我把2个值构造成“a:{{$a.id}}|b:{{b.id}}”这样一个字符串,现在我应该如何把这个字符串传递给func函数?


回复讨论(解决方案)

{fuctionA url="str2"|cat:$onetopic.id|cat:"str2"}

Statement:
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