函数原型
normalize_whitespace( string $str ): string
函数描述
Normalizes EOL characters and strips duplicate whitespace.
是否弃用
未弃用
函数参数
-
$str
string
Required - The string to normalize.
函数返回值
string The normalized string.
函数位置
File: wp-includes/formatting.php.
函数源码
function normalize_whitespace( $str ) {
$str = trim( $str );
$str = str_replace( "\r", "\n", $str );
$str = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
return $str;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |

