当我跑步时:
$url='foldername';
$dir = opendir($url);
//List files in images directory
while (($file = readdir($dir)) !== false)
{
echo "filename: " . $file . "<br />";
}
closedir($dir);
...它输出:
filename: a.gif
filename: file.html
filename: g.gif
filename: gg.html
我想通过 URL 查看另一台服务器上的所有文件和文件夹:
$url="http ://example.com"
如何查找其中的文件和文件夹名称example.com
?
有可能的。只是必须走出盒子。唯一的缺陷是索引输出
<?
$matches = array();
preg_match_all("/(a href\=\")([^\?\"]*)(\")/i", get_text('http://www.website.com/ images/'), $matches);
foreach($matches[2] as $match)
{
echo $match . '<br>';
}
function get_text($filename)
{
$fp_load = fopen("$filename", "rb");
if ( $fp_load )
{
while ( !feof($fp_load) )
{
$content .= fgets($fp_load, 8192);
}
fclose($fp_load);
return $content;
}
}
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)