欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用PHP下載CSS文件中的圖片的代碼

 更新時(shí)間:2013年09月24日 09:50:48   作者:  
CSS文件中的圖片在以前不知道該如何下載,而現(xiàn)在卻可以使用php簡(jiǎn)單實(shí)現(xiàn)了,具體的如下,感興趣的朋友可以參考下
共享一段使用PHP下載CSS文件中的圖片的代碼
復(fù)制代碼 代碼如下:

<?php
//note 設(shè)置PHP超時(shí)時(shí)間
set_time_limit(0);

//note 取得樣式文件內(nèi)容
$styleFileContent = file_get_contents('images/style.css');

//note 匹配出需要下載的URL地址
preg_match_all("/url\((.*)\)/", $styleFileContent, $imagesURLArray);

//note 循環(huán)需要下載的地址,逐個(gè)下載
$imagesURLArray = array_unique($imagesURLArray[1]);
foreach ($imagesURLArray as $imagesURL) {
file_put_contents(basename($imagesURL), file_get_contents($imagesURL));
}
?>

相關(guān)文章

最新評(píng)論