函数原型
like_escape( string $text ): string
函数描述
Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.
是否弃用
Warning: This function has been deprecated. Use wpdb::esc_like() instead.
函数参数
-
$text
string
Required - The text to be escaped.
函数返回值
string text, safe for inclusion in LIKE query.
函数位置
File: wp-includes/deprecated.php.
函数源码
function like_escape($text) {
_deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' );
return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 4.0.0 | Use wpdb::esc_like() |
| 2.5.0 | Introduced. |

