Connection address a between the img Image address and the regular content in the regular article content _ PHP Tutorial

Source: Internet
Author: User
The img Image address in the regular article content and the connection address in the regular content. This example describes how to use the regular expression in php to obtain what we want, the above example is to put all the link addresses and image addresses of the document content string. this example mainly describes how to use the regular expression in php to obtain what we want, the above example is to take out all the link addresses and image addresses of the document content string, so it is much more convenient to use regular expressions.

The img Image address in the regular article content and the connection address in the regular content

$ Body = '';
$ Link = 'tutorial on creating fdas webpages ';
$ Array = "aa, bb, cc, ee, ff, ss, ffa, ees, fde, MCM ";
$ V = explode (',', $ array );
If (is_array ($ v ))
{

$ Vlen = sizeof ($ v)-1;
$ Mt = mt_rand (1, $ vlen );
$ Motype = $ v [$ mt];
}
Else
{
$ Motype = $ array;
}

$ Link = preg_match_all ('/preg_match_all ("/(src | SRC) = [" |' |] {0,} (Image /(. *). (gif | jpg | jpeg | png | bmp)/isU ", $ body, $ img_array );

Print_r ($ img_array [2] [0]);
Echo'

';
Echo $ link_array [2] [0];


This example mainly describes how to use php to get what we want. the above example is to retrieve all the link addresses and image addresses of the document content string, it is much easier for us to use regular expressions.
This site's original tutorial, reprinted with the source www. bKjia. c0m

...

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.