add_clean_index()

热度:75
Function:向指定表添加索引。
版本 20190723
所属分类 Functions
可使用页面 All
默认值

add_clean_index( string $table, string $index )

  • 向指定表添加索引。


参数:

$table

(string) (Required) 数据库表名。


$index

(string) (Required) 数据库表索引列。


Return:

(true) True, 完成执行时。


示例:

function add_clean_index( $table, $index ) {

    global $wpdb;

    drop_index( $table, $index );

    $wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" );

    return true;

}


问题反馈反馈和建议QQ群:785318993