簡體   English   中英

如何使用php查找遠程網頁中所有文件的列表

[英]how to find list of all files in a remote web page using php

我是 PHP 的初學者,我想列出在遠程網頁中使用的所有文件,並使用 PHP 在.js.css文件中使用。

例如,我想獲取在http://sitename.com/gallery.html使用的所有文件的列表,我需要一個這樣的列表:

/css/gallery.css (using in gallery.html)
/css/rtl.css (this file imported in gallery.css)
/images/bodybg.png (this file imported in gallery.css)
/images/gallery/image1.jpg (using in gallery.html)
/images/gallery/image2.jpg (using in gallery.html)
...

這樣,在測試網頁的結果中,它列出了網頁中正在使用的所有文件。

PHP 中最好的方法

 <?php $f = file_get_contents('gallery.html'); $_1 = explode('<link', $f); $_2 = explode('<LINK', $f); print_r($_1); echo '<br/><br/>'; print_r($_2); ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM