通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
\plugins\自定义插件名称 block.test.php ~~~ <?php function smarty_block_test($params, $content){ $replace = $params['replace']; $maxnum = $params['maxnum']; if($replace == 'true'){ $content = str_replace(',', ',', $content); $content = str_replace('。', '.', $content); } $content = substr($content, 0, $maxnum); return $content; } ?> ~~~ 赋值 ~~~ $smarty->assign("str",'hello my name is cy,how are you?。'); $smarty->display('content.tpl'); ~~~ tpl中调用 ~~~ {test2 replace='true' maxnum=29} {$str} {/test2} ~~~