PHP is extracting all of the IMG attribute values, PHP extracts the img attribute value
$ext= ' gif|jpg|jpeg|bmp|png ';//list image suffixes to achieve multi-extension matching by http://www.k686.com Green software$str= ''; $list=Array();//The result map is stored here$c 1=Preg_match_all('/php is extracting all the attribute values of IMG/',$str,$m 1);//Remove all img Tag Text First for($i= 0;$i<$c 1;$i++) {//take attributes on all img tags $c 2=Preg_match_all('/(\w+) \s*=\s* (?:(?:( ["\']) (.*?) (? =\2)) | ([^\/\s]*)) /',$m 1[0] [$i],$m 2);//match all of the attributes for($j= 0;$j<$c 2;$j++) {//structural reorganization of matched results $list[$i][$m 2[1] [$j]] = !Empty($m 2[4] [$j]) ?$m 2[4] [$j] :$m 2[3] [$j]; } } Print_r($list);//View result Variables
http://www.bkjia.com/PHPjc/1059462.html www.bkjia.com true http://www.bkjia.com/PHPjc/1059462.html techarticle PHP is extracting all of the IMG attribute values, PHP extracts the img attribute value $ext = ' gif|jpg|jpeg|bmp|png ';//list the image suffix to achieve multiple extension matching by http://www.k686.com Green software $st ...