


PHP uses preg_match_all to match pictures in articles. What does match mean? match function sid not matc
Sometimes we need to use php to get images from web pages and save them. Here we can use preg_match_all to match the image address. Coders in need can refer to
preg_match_all function:
int preg_match_all ( string pattern, string subject, array matches [, int flags] ) performs a global regular expression match, searches the subject for all content that matches the regular expression given by pattern and puts the results into matches in the order specified by flags.
After searching for the first match, subsequent searches start from the end of the previous match.
flags can be a combination of the following flags (note that it does not make sense to use PREG_PATTERN_ORDER and PREG_SET_ORDER together):
PREG_PATTERN_ORDER Sort the results so that $matches[0] is the array matching all patterns, and $matches[1] is the first bracket. An array of strings matched by the subpattern, and so on!
<?<span>php </span><span>$con</span> = <span>file_get_contents</span>("http://www.xxx.com/news/jb-1.html"<span>); </span><span>$pattern</span>="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/"<span>; </span><span>preg_match_all</span>(<span>$pattern</span>,<span>$con</span>,<span>$match</span><span>); </span><span>print_r</span>(<span>$match</span><span>); </span>?>
<span>Array</span><span>( [</span>0] => <span>Array</span><span> ( [</span>0] => <img src="http://www.xxx.com/usr/themes/dddefault/images/logo.png" alt="php preg match,php preg match all,filesmatch php,php preg match函数,php中preg match,match,puma match,match交友网站,itunes match订购,itunes match,服饰间的搭配match,mix match,match是什么意思,match函数,sid not matc" /><span> [</span>1] => <img title="码农教程上线了" src="http://www.xxx.com/usr/uploads/2012/09/531656480.jpg" alt="php preg match,php preg match all,filesmatch php,php preg match函数,php中preg match,match,puma match,match交友网站,itunes match订购,itunes match,服饰间的搭配match,mix match,match是什么意思,match函数,sid not matc" /><span> [</span>2] => <img src="http://www.xxx.com/usr/uploads/2012/09/2647136297.jpg" alt="php preg match,php preg match all,filesmatch php,php preg match函数,php中preg match,match,puma match,match交友网站,itunes match订购,itunes match,服饰间的搭配match,mix match,match是什么意思,match函数,sid not matc" /><span> ) [</span>1] => <span>Array</span><span> ( [</span>0] => http:<span>//</span><span>www.xxx.com/usr/themes/dddefault/images/logo.png</span> [1] => http:<span>//</span><span>www.xxx.com/usr/uploads/2012/09/531656480.jpg</span> [2] => http:<span>//</span><span>www.xxx.com/usr/uploads/2012/09/2647136297.jpg</span><span> ) )</span>
The above introduces how PHP uses preg_match_all to match the pictures in the article, including the content of match and PHP. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

In this chapter, we are going to learn the following topics related to routing ?

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.
