All pictures and picture addresses in the PHP regular content

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags .net address content image net network php programming

All pictures and picture addresses in regular content of PHP tutorial

Method One
$body = "<img src=" image/2009112422220515.gif "alt=" Real Estate network 111cn.net "border=" 0 "/>";
Preg_match_all ("/(SRC|SRC) =[" | |] {0,} (image/(. *). (gif|jpg|jpeg|png|bmp)) /isu ", $body, $img _array);
Print_r ($img _array);

Method Two
Preg_match_all ("/src=") (file:///.*? PNG) "/I", $body, $a);

Method Three
Preg_match_all ("/<p>.*src=" ([^^]*?). *</p>/i ", $body, $match);
Print_r ($match [1]);

Method Four

echo preg_replace (/<imgs+src=)/(. *) ">/i", ' <img src= ' file/$2 ' > ', $body);
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.