这项工作:
$values = array();
foreach ( $_POST as $key => $value ) {
$values[] = $wpdb->prepare( "(%d,%s,%s)", $post_id, $key, $value );
}
$query = "INSERT INTO {$table} (post_id, meta_key, meta_value) VALUES ";
$query .= implode( ",\\n", $values );
$wpdb->query( $wpdb->prepare( "$query", $values ) );
但它发出了这样的通知:
PHP注意:调用了wpdb::prepareincorrectly.查询中传递的参数数(3)的占位符数(0)不正确。
我怎样才能避免通知?