正则表达式 - php 获取文章中的图片地址,替换为markdown语法

WBOY
Release: 2016-06-06 20:38:13
Original
1176 people have browsed it

最近把html文章的备份转为markdown,用了这个html to markdown,不能转图片的markdown语法如何用正则匹配出所有图片地址,然后用markdown语法进行替换?

回复内容:

最近把html文章的备份转为markdown,用了这个html to markdown,不能转图片的markdown语法如何用正则匹配出所有图片地址,然后用markdown语法进行替换?

图片肯定是能转的,你的问题应该是有些文章的图片使用了懒加载,没有设置src属性,而改为了类似 data-src 这种属性,这种只能自己处理下,每家网站可能都写的不一样。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!