欢迎各位兄弟 发布技术文章
这里的技术是共享的
{$str|json}, 这是 $Smarty->registerPlugin("modifier",
{$num|json}, 这是 $Smarty->registerPlugin("modifier",
{$bool|json}, 这是 $Smarty->registerPlugin("modifier",
{$arr|@json}, json修饰符前面必须加上 @ 字符,这样数组变量就可以传递到 json_modifier()。如果没有使用 @ 字符,修饰符函数会对数组的每一个元素进行调用。
{json os=$str on=$num ob=$bool oa=$arr}, 这里传参这是 $Smarty->registerPlugin("function",
function fn_display($_id, $template) { $_return = "test"; $template->assign("display", $_return);}$this->obj_smarty = new Smarty(); //初始化 Smarty 对象$this->obj_smarty->registerPlugin("function", "display", "fn_display"); //注册自定义函数{call_display call_id=7}{$display}
来自 http://www.oschina.net/code/snippet_1772947_47525