Home > Backend Development > PHP Tutorial > PHP image address and deletion of URL part regular method_PHP tutorial

PHP image address and deletion of URL part regular method_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 16:59:01
Original
859 people have browsed it

The following method is very simple, we only need to delete all the websites opened with http:// in $tmppath,


$picpath =preg_replace("/[a-za-z]+://[^ |/|s]*/",'',$tmppath);//Remove the URL part

This regular expression is to get all the addresses of all pictures in the string using src src regardless of size, and save them in $tmpdata[2].
preg_match_all("/src=["|'|s|s]([^|/|>]*){0,}(([^>]*).(gif|jpg|png))/isu ",$body,$tmpdata);

$picspath =array_unique($tmpdata[2]);//The addresses of all pictures in the body

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631340.htmlTechArticleThe following method is very simple, we only need to delete all the websites opened with http:// in $tmppath , $picpath =preg_replace(/[a-za-z]+://[^ |/|s]*/,'',$tmppath);//Remove the URL part...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template