PHP extracts the image address in the database content and loops the output_PHP tutorial

WBOY
Release: 2016-07-21 15:39:57
Original
1080 people have browsed it

Copy code The code is as follows:

/*
1 (?s) represents Pattern.DOTALL, which means matching newlines, allowing
2 .*? appearing in multiple lines in img means non-greedy matching of any character until the subsequent condition appears
3 ?: means this match but is not captured, that is, it does not appear in the result [.gif|.jpg ] means or
*/
$pattern="//";
$str='

';
preg_match_all($pattern,$str,$match);
print_r($match);
/*
Array
(
[0] => Array
(
[0] => =""/>
[1] =>
[2] = >
)
[1] => Array
(
[0] => upfiles/2009/07/1246430143_4.jpg
[1] => upfiles/2009/07/1246430143_3.jpg
[2] => upfiles/2009/07/1246430143_1 .jpg
)
)
*/

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321480.htmlTechArticleCopy the code as follows: /* 1 (?s) represents Pattern.DOTALL, which matches newlines and allows img appears in multiple lines 2.*? means non-greedy matching of any character until the following condition appears...
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