?
本文檔使用 php中文網(wǎng)手冊 發(fā)布
排版幫助文件包含一些函數(shù),這些函數(shù)可以幫助您以語義相關(guān)的方式格式化文本。
加載此助手
可用職能
使用以下代碼加載此助手:
$this->load->helper('typography');
現(xiàn)有下列職能:
auto_typography($str[, $reduce_linebreaks = FALSE])
參數(shù): | $ str(string) - 輸入字符串$ reduce_linebreaks(bool) - 是否將多個雙換行符的實例減少到兩個 |
---|---|
返回: | HTML格式的印刷版安全字符串 |
返回類型: | 串 |
$ str(string) - 輸入字符串
$ reduce_linebreaks(bool) - 是否將多個雙換行符的多個實例減少為兩個
Returns: HTML-formatted typography-safe string
Return type: string
Formats text so that it is semantically and typographically correct HTML.
此函數(shù)是CI_Typography::auto_typography()
有關(guān)更多信息,請參見排版庫文件。
用法示例:
$ string = auto_typography($ string);
注
排版格式可以是處理器密集型的,特別是如果您有很多內(nèi)容正在格式化。如果選擇使用此函數(shù),則可能需要考慮緩存你的書頁。
nl2br_except_pre($str)
參數(shù): | $ str(string) - 輸入字符串 |
---|---|
返回: | 帶有HTML格式的換行符的字符串 |
返回類型: | 串 |
$ str(string) - 輸入字符串返回:帶HTML格式換行符的字符串返回類型:字符串將換行符轉(zhuǎn)換為<br />標記,除非它們出現(xiàn)在<pre>標記中。該函數(shù)與原生PHP nl2br()
函數(shù)相同,只是它忽略了<pre>標記。用法示例:$ string = nl2br_except_pre($ string); entity_decode($str, $charset = NULL)
參數(shù):$ str(字符串) - 輸入字符串$ charset(字符串) - 字符setReturns:帶有解碼HTML實體的字符串返回類型:字符串
$ str(string) - 輸入字符串
$ charset(字符串) - 字符集
Returns: String with decoded HTML entities
Return type: string
This function is an alias for `CI_Security::entity_decode()`. Fore more info, please see the [Security Library](../libraries/security) documentation.