且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用PHP从CSS文件中提取图像的链接的***方法是什么?

更新时间:2023-11-20 22:22:16

function getImageUrls($input_string) {
   $matches = array();
   preg_match_all('/url\((.+?)\);/i', $input_string, $matches);
   return preg_replace('/url\((.+?)\);/i', '$1', $matches);
}

拉出匹配,然后格式化它们只保留url路径。

something like that anyways. pull the matches out and then format them to keep only the url path.