dongpao1905 2016-03-06 21:50
浏览 21

用文件()获取网站的css代码

I've got this code:

$path = $site."/".$stylesheets[0] ("http://example.com/thecssfile.css")
$css = file($path);

But now, there is the sourcecode of http://example.com in the $css variable. How can I get the code of http://example.com/thecssfile.css. If I set the $path variable directly to "http://example.com/thecssfile.css" it works but I want it dynamic.

  • 写回答

1条回答 默认 最新

  • douji8033 2016-03-07 03:08
    关注

    You assume, that $stylesheets[0] is thecssfile.css, but it is not. You can see this by var_dump($stylesheets[0])

    You need to make sure, it has the value you want. In your case:

    $stylesheets = [0 => 'thecssfile.css']
    
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效