💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
\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} ~~~