从表中删除指定的索引。
原型
drop_index( string $table, string $index )
参数
$table
(string)
(Required)
数据库表名。
$index
(string)
(Required)
要删除的索引名称。
返回值
(true)
是的,完成后。
源文件
路径:wp-admin/includes/upgrade.php
<?php
...
function drop_index($table, $index) {
global $wpdb;
$wpdb->hide_errors();
$wpdb->query("ALTER TABLE `$table` DROP INDEX `$index`");
// Now we need to take out all the extra ones we may have created
for ($i = 0; $i < 25; $i++) {
$wpdb->query("ALTER TABLE `$table` DROP INDEX `{$index}_$i`");
}
$wpdb->show_errors();
return true;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/drop_index/