Home > Article > Backend Development > The img image address in the regular article content and the a connection address in the regular content_PHP tutorial
This example mainly talks about how to use regular expressions in php to get what we want. The above example is to take out all the link addresses and image addresses of the article content string, so we need to use regular expressions It's much more convenient.
The img image address in the regular article content and the a connection address in the regular content
$body ='';
$Link ='fdasWebpage production tutorial';
$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];
This example mainly talks about how to use regular expressions in the PHP tutorial to get what we want. The above example is to take out all the link addresses and image addresses of the article content string. It is convenient for us to use regular expressions. Much more.
Original tutorial on this site, please indicate the source when reprinting: www.bKjia.c0m