directory search
Array Array Helper Benchmarking Benchmarking Class Caching Caching Driver Calendaring Calendaring Class CAPTCHA CAPTCHA Helper Config Config Class Cookie Cookie Helper Database Connecting to your Database Custom Function Calls Database Caching Class Database Configuration Database Forge Class Database Metadata Database Quick Start: Example Code Database Reference Database Utility Class DB Driver Reference Generating Query Results Queries Query Builder Class Query Helper Methods Transactions Date Date Helper Directory Directory Helper Download Download Helper Email Email Class Email Helper Encrypt Encrypt Class Encryption Encryption Library File File Helper File Uploading File Uploading Class Form Form Helper Form Validation Form Validation FTP FTP Class Functions compatibility_functions common_functions HTML HTML Helper HTML Table HTML Table Class Image Manipulation Image Manipulation Class Inflector Inflector Helper Input Input Class Javascript Javascript Class Language Language Class Language Helper Loader Loader Class Migrations Migrations Class Number Number Helper Output Output Class Pagination Pagination Class Path Path Helper Security Security Class Security Helper Session Session Library Shopping Cart Shopping Cart Class Smiley Smiley Helper String String Helper Template Parser Template Parser Class Text Text Helper Trackback Trackback Class Typography Typography Class Typography Helper Unit Testing Unit Testing Class URI URL User Agent XML XML-RPC and XML-RPC Server Zip Encoding Zip Encoding Class XML-RPC and XML-RPC Server Classes XML Helper User Agent Class URL Helper URI Class
characters

排版帮助文件包含一些函数,这些函数可以帮助您以语义相关的方式格式化文本。

  • 加载此助手

  • 可用职能

加载此助手

使用以下代码加载此助手:

$this->load->helper('typography');

可用职能

现有下列职能:

auto_typography($str[, $reduce_linebreaks = FALSE])

参数:

$ str(string) - 输入字符串$ reduce_linebreaks(bool) - 是否将多个双换行符的实例减少到两个

返回:

HTML格式的印刷版安全字符串

返回类型:

  • $ strstring) - 输入字符串

  • $ reduce_linebreaksbool) - 是否将多个双换行符的多个实例减少为两个

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格式的换行符的字符串

返回类型:

  • $ strstring) - 输入字符串返回:带HTML格式换行符的字符串返回类型:字符串将换行符转换为<br />标记,除非它们出现在<pre>标记中。该函数与原生PHP nl2br()函数相同,只是它忽略了<pre>标记。用法示例:$ string = nl2br_except_pre($ string); entity_decode($str, $charset = NULL)参数:$ str(字符串) - 输入字符串$ charset(字符串) - 字符setReturns:带有解码HTML实体的字符串返回类型:字符串

  • $ strstring) - 输入字符串

  • $ 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.
Previous article: Next article: