strip_tags() 函數剝去 HTML、XML 以及 PHP 的標籤。
複製程式碼 程式碼如下:
world!” ); ?>
複製程式碼 程式碼如下:
$smarty = new Smartymarty = new Smartymarty = new Smartymart
$smarty->assign('articleTitle', “Blind Woman Gets New Kidney from Dad she Hasn't Seen in years strong>.”);
$smarty->display('index.tpl');
複製程式碼 程式碼如下:
{$articleTitle}
{$articleTitle|strip_tags}
輸出結果:複製程式碼 程式碼如下:
Blind Woman Gets New Kidney from Dad she Hasn 't Seen in years.
Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.
複製程式碼 程式碼如下:
{$article.content|truncate:35:”…”:true}
以上就介紹了 smarty中先strip_tags過濾html標籤後truncate截取文章運用,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。