W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
轉(zhuǎn)換連續(xù)空格,回車和tab到單個空格或是指定字符串。
如果你希望轉(zhuǎn)換模板文字內(nèi)的空格,使用內(nèi)置的 {strip}
函數(shù)。
Example 5.19. strip
<?php $smarty->assign('articleTitle', "Grandmother of\neight makes\t hole in one."); $smarty->display('index.tpl'); ?>
模板:
{$articleTitle} {$articleTitle|strip} {$articleTitle|strip:' '}
輸出:
Grandmother of eight makes hole in one. Grandmother of eight makes hole in one. Grandmother of eight makes hole in one.
參見 {strip}
和 truncate
.
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: