Php uses preg_match_all to match the image in the article ,. Php uses preg_match_all to match the picture in the article. sometimes we need to use php to retrieve and save the picture on the webpage. here we can use preg_match_all to match the picture in the article. php uses preg_match_all to match the picture in the article,
Sometimes we need to use php to retrieve and save the images on the web page. here we can use preg_match_all to match the image address. For more information about the coders, see
Preg_match_all function:
Int preg_match_all (string pattern, string subject, array matches [, int flags]) executes a global regular expression match.
Search all the content that matches the regular expression given by pattern in the subject and put the result in the matches in the order specified by flags.
After the first match is found, the next search starts from the end of the previous match.
Flags can be a combination of the following tags (note that it is meaningless to combine PREG_PATTERN_ORDER and PREG_SET_ORDER ):
PREG_PATTERN_ORDER sorts the results so that $ matches [0] is an array of all pattern matching, $ matches [1] is an array consisting of strings matching the child pattern in the first bracket, and so on!
Example:
/";preg_match_all($pattern,$con,$match);print_r($match);?>
Result:
Array( [0] => Array ( [0] => [1] => [2] => ) [1] => Array ( [0] => http://www.xxx.com/usr/themes/dddefault/images/logo.png [1] => http://www.xxx.com/usr/uploads/2012/09/531656480.jpg [2] => http://www.xxx.com/usr/uploads/2012/09/2647136297.jpg ))
Address: http://www.manongjc.com/article/708.html
Related reading:
Php preg_match_all replace all img content with str_replace
Difference between php preg_match and preg_match_all functions
Php preg_match matches instances of different languages
Solution to apache crash caused by PHP preg_match_all
Description of/u,/I, and/s in php preg_match regular expression matching
Php preg_match function matching string length problem
What is preg_match isU in php?
Php preg_match_all regular expression function usage
Php preg_match regular expression function example
Use of javascript regular expressions test () and exec ()
Non-greedy pattern matching in php regular expressions
Php regular expression efficiency greedy, non-greedy, and backtracking analysis
Javascript regular expression greedy mode and non-greedy mode
Analysis of Global matching modes of regular expressions in Javascript
Javascript regular expression matches string
Js verification (judgement) whether it is a web site
Php regular expression function example
Php preg_match function and php preg_match_al function l instance, method, example
Php preg_match_all () function instance
Php preg_match regular expression function instance
Sometimes we need to use php to retrieve and save images on the webpage. here we can use preg_match_all to match images...