Products
GG网络技术分享 2025-03-18 16:13 2
esc_sql() 用来过滤准备添加到 Sql 语句里边的字符串,防止 Sql 注入和 Sql 语句被数据干扰出现异常。
esc_sql( $data );
$data
(字符串)(必须)要过滤的字符串。
默认值:None
(字符串)返回过滤后的字符串,可以直接添加到 Sql 语句里。
$name = esc_sql( $name );$status = esc_sql( $status );
$wpdb->get_var( \"SELECT something FROM table WHERE foo = \'$name\' and status = \'$status\'\" );
此函数位于:wp-includes/formatting.php
Demand feedback