[29期] 小东西 ,php 写的下载css中的图片。
好久没写战地日记了<?php
[*]
[*]//设置PHP超时时间
[*]set_time_limit(0);
[*]
[*]//取得样式文件内容
[*]$styleFileContent = file_get_contents('style.css');
[*]
[*]//匹配出需要下载的URL地址
[*]preg_match_all("/url\((.*)\)/", $styleFileContent, $imagesURLArray);
[*]
[*]//循环需要下载的地址,逐个下载
[*]$imagesURLArray = array_unique($imagesURLArray);
[*]
[*]foreach($imagesURLArray as $imagesURL) {
[*]file_put_contents(basename($imagesURL), file_get_contents($imagesURL));
[*]}
[*]
[*]?>
此工具 是为了自己仿站方便。共享之,而且css中图片路径 要绝对。(大站基本上都是绝对路径)
其他的没有啥看不懂了吧。
另外在 文凯老师的建议下 编码平台换到了linux ,我选择的是ubuntu+vim。
还有第一个项目完成大部分了。默认主题 缅怀经典 Wdinows 3.1 ! 见图:
页:
[1]