Home > php教程 > php手册 > body text

正则文章内容中img图片地址与正则内容中的a连接地址

WBOY
Release: 2016-06-13 10:09:26
Original
980 people have browsed it

本篇实例主要是讲到关于如何使用php中正则表达试来获取我们想要的东西,上面的实例就是要把文章内容字符串的链接地址与图片地址全部取出来,所有我们要正则就方便多了。

正则文章内容中img图片地址与正则内容中的a连接地址

  $body ='楼盘网loupan';
  $Link ='fdas网页制作教程教程';
  $array ="aa,bb,cc,ee,ff,ss,ffa,ees,fde,ecd";
  $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];


  本篇实例主要是讲到关于如何使用php教程中正则表达试来获取我们想要的东西,上面的实例就是要把文章内容字符串的链接地址与图片地址全部取出来,所有我们要正则就方便多了。
  本站原创教程,转载注明来源www.bKjia.c0m

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 Recommendations
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!