convert_chars( string $content, string $deprecated = '' )
将单个字符转换为`&`(也称为`&`)
Converts lone & characters into `&` (a.k.a. `&`)
目录锚点:#参数#返回#源码
参数 | 类型 | 必填 | 说明 |
$content |
(string) |
必需 |
要转换的字符串。 |
$deprecated |
(string) |
可选 |
不使用。 |
(string)转换的string。
/**
* Converts lone & characters into `&` (a.k.a. `&`)
*
* @since 0.71
*
* @param string $content String of characters to be converted.
* @param string $deprecated Not used.
* @return string Converted string.
*/
function convert_chars( $content, $deprecated = '' ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '0.71' );
}
if ( strpos( $content, '&' ) !== false ) {
$content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content );
}
return $content;
}
更新版本 |
源码位置 |
使用 |
被使用 |
0.71 |
wp-includes/formatting.php:2364 |
5 |
1 function |