初秋的春天 發表於 2023-12-12 00:00:00

DedeCMS的TAG标签无法保存和自动删除的解决方法

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        几个月前,我的升级5.5,不幸的是TAG出现了故障,具体问题是:在后台发布文章,TAG无法保存,自动删除。今天再仔细研究一下,是不保存新的 TAG,之前填写过的TAG可以保存。例如我填写了“电脑,电脑教程,Word”几个TAG,发布以后可能只显示“电脑,Word”两个TAG。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        本来判断是程序的问是,但用其它正常使用的程序用这个数据库,问题依旧;那么就肯定是数据库的问题了,DedeCMS后台有“SQL命令运行器”, 可以看到DedeCMS所有的数据表,在这里我找到了两个TAG的表,“dede_tagindex”和“dede _taglist”,选中其中一个表,点击查看表结构,然后拿其它程序对比一下,发现了问题。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        dede_tagindex 这个表少了一个“`typeid` smallint(5) unsigned NOT NULL default '0',”字段,“`tag` char(<strong>20</strong>) NOT NULL default '',”应该是12,我的变成了20。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        dede _taglist 这个表多出了一个“KEY `aid` (`aid`)”字段。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        问题找出来了,接下来就是如何把它添加、删除和修改的问题了,具体方法如下:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        进入phpmyadmin里面点击左边数据库下拉菜单,选择你的网站数据库,拉到最下面,找到“dede_tagindex”这个表(前面的Dede是你安装时候的名称,可能不同),点击它打开,然后右面会显示出表结构,在tag后面添加一个typeid字段</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <strong>新字段里面的内容填写如下:</strong><br><span>(=后面为空的不用填写)</span></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<table align="center" border="0" cellpadding="6" cellspacing="0" style='border-collapse: collapse; border-spacing: 0px; empty-cells: show; border-style: solid; border-color: rgb(204, 204, 204); text-align: center; margin-top: 0.54em; clear: both; font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;' width="95%"><tbody><tr>
<td bgcolor="#fdfddf">
                                字段=typeid<br>
                                型=SMALLINT<br>
                                度/值*1=5<br>
                                整理=<br>
                                属性=UNSIGNED<br>
                                Null=not null<br>
                                默认2=0<br>
                                额外=</td>
                </tr></tbody></table>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        填写完成后点击保存,。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        tag这个字段中“`tag` char(20) NOT NULL default '',”把长度值改成12。</p>
<center style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>
         </center>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        点击tag字段后面的更改,把长度/值改为12</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        dede _taglist 这个表中多出的“KEY `aid` (`aid`)”字段,进去直接删除掉就可以了。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        再去添加一个新的TAG标签看看,是不是OK了!</p>
頁: [1]
查看完整版本: DedeCMS的TAG标签无法保存和自动删除的解决方法