获取wp_posts表里面post_content内容里面的网址

admin
admin
admin
374
文章
102
评论
2022年3月14日08:00:00
评论
76

我们的需要:获取wp_posts表里面post_content内容里面的网址

比如post_content内容网址格式为:<a rel="external nofollow" target="_blank" href="https://www.mianfeiziji.cn/abg/ddd/eee/dgdfgf.rar" >下载地址</a>,我们要如何才可以提取到这里面的网址呢?

我们先建一个临时表wp_content,设置两个字段,id和post_content,id为主键、bigint数据类型自增字段,post_content为longtext字段

CREATE TABLE `wp_content` ( `id` BIGINT NOT NULL AUTO_INCREMENT , `post_content` LONGTEXT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;

然后执行下面的数据表插入命令:

insert into wp_content (id,post_content) select 
null,
substr(reverse(substr(reverse(post_content),1,instr(reverse(post_content),'nc.ijiziefnaim.www')+25)),
1,
instr(reverse(substr(reverse(post_content),1,instr(reverse(post_content),'nc.ijiziefnaim.www')+25)),'"')-1) 
from wp_posts,wp_term_relationships,wp_term_taxonomy 
where ID=object_id 
and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id 
and post_type="post" 
and post_status = "publish" 
and wp_term_relationships.term_taxonomy_id = 111 
and taxonomy = "category"

后面的from、、where、、这一段是选出分类id为111的wp_posts里面的post_content

admin
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: