drop_index

函数
drop_index ( $table, $index )
参数
  • (string) $table Database table name.
    Required:
  • (string) $index Index name to drop.
    Required:
返回值
  • (true) True, when finished.
定义位置
相关方法
noindexget_dropinsadd_clean_index_get_dropinsdo_action
引入
1.0.1
弃用
-

drop_index: 这个函数从WordPress的一个指定的数据库表中删除一个索引。它是一个用于操作数据库表的辅助函数。

从一个表中删除指定的索引。

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;
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 18:32:58

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: