【发布时间】:2014-03-08 20:09:47
【问题描述】:
我已经使用 html dom 解析器和 ajax post 在我的本地主机中下载了 css 文件..
<?php
require'simple_html_dom.php';
$srcCode = $_POST['doc'];
$url=$_POST['Url'];
$url_path=$url;
$html = file_get_html('template/'.$name.'.html');
if(!file_exists('template/css'))
{mkdir('template/css',0777, true);}
foreach($html->find('link') as $link)
{
$linkpath=$link->href;
$links = explode("/", $linkpath);
$linkName = end($links);
file_put_contents('/template/css/'.$linkName,file_get_contents($url_path.$linkpath));
}
?>
现在我要使用 php 读取那些 css 文件..或者说我要获取(下载)这些 css 的所有图像 src..
background: url(../images/interface.png) no-repeat -1px -680px;
border: 0 none;
color: #534a39;
font-size: 16px;
height: 52px;
line-height: 42px;
margin: 24px auto 25px;
width: 281px;
text-indent: 40px;
如何解析css元素??如何获取css内容??请帮帮我……
【问题讨论】:
标签: javascript php jquery html css