有人能告诉我这个函数有什么问题吗?
function xattachments_db_install() {
global $wpdb;
$xattachments_db_version = "1.0";
$table_name = $wpdb->prefix ."xattachments";
$sql = "CREATE TABLE IF NOT EXISTS ".$table_name. " (
\'xattachments_id\' int(10) unsigned NOT NULL,
\'xattachments_name\' varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
\'xattachments_title\' varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
\'post_id\' int(10) unsigned NOT NULL,
\'xattachments_data_id\' int(11) NOT NULL,
PRIMARY KEY (\'xattachments_id\')
) ENGINE=MyISAM DEFAULT CHARSET=CHARSET=utf8 COLLATE utf8_bin ;";
require_once(ABSPATH.\'wp-admin/includes/upgrade.php\');
dbDelta($sql);
add_option("xattachments_db_version", $xattachments_db_version);
}
register_activation_hook(__FILE__,\'xattachments_db_install\');
当我激活插件时,它不会生成任何错误消息,但该表没有在数据库中创建。
此函数位于插件文件的最开头。
非常感谢。