排版辅助函数¶
排版辅助函数文件包含了文本排版相关的一些函数。
可用函数¶
该辅助函数有下列可用函数:
- auto_typography($str[, $reduce_linebreaks = FALSE])¶
- 参数: - $str (string) -- Input string
- $reduce_linebreaks (bool) -- Whether to reduce multiple instances of double newlines to two
 - 返回: - HTML-formatted typography-safe string - 返回类型: - string - 格式化文本以便纠正语义和印刷错误的 HTML 代码。 - 这个函数是 CI_Typography::auto_typography() 函数的别名。 更多信息,查看 排版类 。 - Usage example: - $string = auto_typography($string); - 注解 - 格式排版可能会消耗大量处理器资源,特别是在排版大量内容时。 如果你选择使用这个函数的话,你可以考虑使用 缓存。 
- nl2br_except_pre($str)¶
- 参数: - $str (string) -- Input string
 - 返回: - String with HTML-formatted line breaks - 返回类型: - string - 将换行符转换为 <br /> 标签,忽略 <pre> 标签中的换行符。除了对 <pre> 标签中的换行处理有所不同之外,这个函数和 PHP 函数 nl2br() 是完全一样的。 - 使用示例: - $string = nl2br_except_pre($string);