Smarty:indent
2018-10-12 15:33 更新
indent
缩进每一行的字符串,默认是缩进4个空格。 可选的参数可以设置缩进的空格数量。 可选的第二个参数设置缩进使用的字符,如用 "\t"
来代替空格缩进。
参数顺序 | 类型 | 必选参数 | 默认值 | 说明 |
---|---|---|---|---|
1 | integer | No | 4 | 设置缩进多少空格 |
2 | string | No | 一个空格 | 设置用什么字符来进行缩进 |
Example 5.12. indent
<?php $smarty->assign('articleTitle', 'NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25.' ); ?>
模板:
{$articleTitle} {$articleTitle|indent} {$articleTitle|indent:10} {$articleTitle|indent:1:"\t"}
输出:
NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25. NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25. NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25. NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25.
参见 strip
, wordwrap
和 spacify
.
以上内容是否对您有帮助:
更多建议: