![]() |
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
IP: 112.87.0.17
|
|||
|
|||
|
此方法是在保留文章内容的情况下去除超链接,适用于信息采集时入库有别人的链接,自己写着玩的,高手莫见笑 先删除文章内容中超链接的前半部分: update articleset article_info.conten
此方法是在保留文章内容的情况下去除超链接,适用于信息采集时入库有别人的链接,自己写着玩的,高手莫见笑 先删除文章内容中超链接的前半部分: update articleset article_info.content = replace(article.content, substring(article.content, locate('<a ', article.content), locate('>', article.content,locate('<a ', article.content))+1-locate('<a ', article.content) ), ''); 上部代码执行一次能够删除文章内容中的第一个超链接,多执行几次指导影响行数为0为止 下面就是删除文章内容中超链接的后半部分: update article_info set article_info.content = replace(article_info.content,'</a>',''); 另一个实用案例就是删除DEDE文章中的链接且保留链接文字,用下边的SQL语句: update dede_addonarticle set body = replace(body,substring(body,locate("<a ", body),locate(">", body,locate("<a ", body))+1-locate("<a ", body)),""); Last edited by topvip : 2012-07-10 at 08:07 AM |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|