升级插件时如果要修改插件表里的字段,那么需要在upgrade.php里修改,下面是一个例子,给表里新增一个字段,升级插件时upgrade.php就会执行。
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')){
exit('Access Denied');
}
$field_chat = array();
$query = DB::query("SHOW COLUMNS FROM ".DB::table('haozi_chajian'));
while($temp = DB::fetch($query)) {
$field_chat[] = $temp['Field'];
}
if(!in_array('starttime', $field_chat)) {
DB::query("ALTER TABLE ".DB::table('haozi_chajian')." ADD `available` tinyint(1) NOT NULL DEFAULT '0';");
}
$finish = TRUE;
本文作者:符文浩 网址:http://blog.haozi.org/post/435.html发布于 2021-03-21
文章转载或复制请以超链接形式并注明出处。
还没有评论,来说两句吧...