Codeigniter 3参考手册
印刷 | Typography
印刷助手 | Typography Helper
排版帮助文件包含一些函数,这些函数可以帮助您以语义相关的方式格式化文本。
- 加载此助手
- 可用职能
加载此助手
使用以下代码加载此助手:
$this->load->helper('typography');
可用职能
现有下列职能:
auto_typography($str[, $reduce_linebreaks = FALSE])
参数: |
$ 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.
此函数是CI_Typography::auto_typography()
有关更多信息,请参见排版库文件。
用法示例:
$ string = auto_typography($ string);
注
排版格式可以是处理器密集型的,特别是如果您有很多内容正在格式化。如果选择使用此函数,则可能需要考虑缓存你的书页。
nl2br_except_pre($str)
参数: |
$ str(string) - 输入字符串 |
---|---|
返回: |
带有HTML格式的换行符的字符串 |
返回类型: |
串 |
-
$ str(string) - 输入字符串返回:带HTML格式换行符的字符串返回类型:字符串将换行符转换为<br />标记,除非它们出现在<pre>标记中。该函数与原生PHP
nl2br()
函数相同,只是它忽略了<pre>标记。用法示例:$ string = nl2br_except_pre($ string);entity_decode($str, $charset = NULL)
参数:$ 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.
印刷 | Typography相关
CodeIgniter 是一个PHP MVC框架,特点是超轻量级、有数据加密、有灵活URI路由等。对于 PHP 程序员来说,它小巧但功能强大。
主页 | https://codeigniter.com/ |
源码 | https://github.com/bcit-ci/CodeIgniter |
版本 | 3 |
发布版本 | 3.1.5 |