wpdb 创建wp数据表用例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | global $wpdb; $wpdb->donators = $wpdb->prefix.'donators'; //Donators Table Name ### Function: Create Donators Table register_activation_hook(__FILE__,'install'); function install(){ global $wpdb; if(@is_file(ABSPATH.'/wp-admin/upgrade-functions.php')) { include_once(ABSPATH.'/wp-admin/upgrade-functions.php'); } elseif(@is_file(ABSPATH.'/wp-admin/includes/upgrade.php')) { include_once(ABSPATH.'/wp-admin/includes/upgrade.php'); } else { die('We have problem finding your \'/wp-admin/upgrade-functions.php\' and \'/wp-admin/includes/upgrade.php\''); } // Create Donators Table $create_table = "CREATE TABLE $wpdb->donators (". "ID bigint(20) NOT NULL auto_increment,". "BUYER_EMAIL varchar(100) NOT NULL default '',". "ITEMNAME varchar(255) NOT NULL default'',". "ITEMNUMBER varchar(50),". "URL varchar(255),". "USER_MEMO varchar(255),". "PAYMENTDATE varchar(50) NOT NULL default '',". "TXNID varchar(30) NOT NULL default '',". "PAYMENT_GROSS varchar(10) NOT NULL default '',". "PAYMENT_FEE varchar(10) NOT NULL default '',". "MC_CURRENCY varchar(5) NOT NULL default '',". "INVOICE varchar(255) NOT NULL default '',". "PRIMARY KEY (ID));"; maybe_create_table($wpdb->donators, $create_table); add_option("donators_db_version", "1.0"); } |
codex.wordpress: 建表文档
http://codex.wordpress.org.cn/Creating_Tables_with_Plugins
| -欢迎为本文评级 |
No donations within the last 180 days.Who make donation will leave message at here.Donate Now.
This a wordpress plugin Wp-Donators.It provides a smart donation function to autoleave the sponsor information in this container after payment. People can donate and submit name/URL or TextLink AD. The information of the latest donors are displayed in the cloud. The more a person donates, the bigger their link will be.It's will support most popular payment interface in future. ParPal Just the first one. More..
Powered By:WP-DONATORS
相关日志 |
本文读者也关心以下内容:
|















































Leave a reply