函数原型
esc_sql( string|array $data ): string|array
函数描述
Escapes data for use in a MySQL query.
是否弃用
未弃用
函数参数
-
$data
string|array
Required - Unescaped data.
函数返回值
string|array Escaped data, in the same type as supplied.
函数位置
File: wp-includes/formatting.php.
函数源码
function esc_sql( $data ) {
global $wpdb;
return $wpdb->_escape( $data );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |

