Share a piece of code that uses PHP to download images in CSS files
Copy the code The code is as follows:
//note Set PHP timeout
set_time_limit(0);
//note Get style file content
$styleFileContent = file_get_contents('images/style.css');
//note Match the URL address that needs to be downloaded
preg_match_all("/url((.*))/", $styleFileContent, $imagesURLArray);
//note Loop the address that needs to be downloaded , download one by one
$imagesURLArray = array_unique($imagesURLArray[1]);
foreach ($imagesURLArray as $imagesURL) {
file_put_contents(basename($imagesURL), file_get_contents($imagesURL));
}
?>
http://www.bkjia.com/PHPjc/313579.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313579.htmlTechArticleShare a piece of code that uses PHP to download images in CSS files. Copy the code as follows: ?php //note Set up PHP Timeout set_time_limit(0); //note Get the style file content $styleFileC...
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