Smarty:count_paragraphs

2018-10-12 15:10 更新

count_paragraphs

計(jì)算變量?jī)?nèi)容有多少個(gè)段落。

Example 5.5. count_paragraphs

<?php

$smarty->assign('articleTitle',
                 "War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.\n\n
                 Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."
                );

?>

模板是:

{$articleTitle}
{$articleTitle|count_paragraphs}

輸出:

War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.

Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.
2
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)