<p class="sougouContent"> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">$tpl = new smarty(); $tpl->registerPlugin('function','func','func'); function func($str){ return $str; }</pre><div class="contentsignin">登入後複製</div></div> <br /> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="sycode" name="code">{{func str='abc'}}</pre><div class="contentsignin">登入後複製</div></div> <br> <br> 问题:此处的abc我如何才能传入多个变量呢? <br> 情况:比如我页面中已经获取到2个值$a.id = 2和$b.id = 3,我把2个值构造成“a:{{$a.id}}|b:{{b.id}}”这样一个字符串,现在我应该如何把这个字符串传递给func函数? </p> <br> <h2>回复讨论(解决方案)</h2> <p class="sougouAnswer"> {fuctionA url="str2"|cat:$onetopic.id|cat:"str2"} </p>