search
Homephp教程php手册正则文章内容中img图片地址与正则内容中的a连接地址

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

Jun 13, 2016 am 10:09 AM
imgphpandhostuseaboutcontentpictureaddresshowExamplearticleregularconnect

本篇实例主要是讲到关于如何使用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

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor