我正在做一个项目,在这个项目中,我想访问通过局域网连接的远程系统的文件夹。
我有一个下拉列表。当我选择远程系统驱动器号(例如: c:,d:)时,该文件夹中的相应文件将显示在我的系统中。
有没有关于这方面的教程?
我试过了,但它只适用于本地系统,而且我无法打开相应的文件。
<html>
<head>
<title>Drive contents</title>
</head>
<body>
</body>
<?php // Php starts here
$myDirectory = opendir("C:\Dream");
$path = "c:";
// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}
// close directory
closedir($myDirectory);
// count elements in array
$indexCount = count($dirArray);
Print ("$indexCount files<br>\n");
// sort 'em
sort($dirArray);
// print 'em
// loop through the array of files and print them all
for($index=0; $index < $indexCount; $index++) {
if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files
print("<a href=\"$dirArray[$index]\">$dirArray[$index]</a>");
echo "<br>";
}
}
?>
</html>发布于 2009-03-14 05:10:04
你的PHP脚本在哪里运行?为了更好地理解,你的脚本在哪里?脚本是否与远程文件在同一台计算机上运行,或者脚本是否在不同的位置?
发布于 2009-03-12 13:45:39
$myDirectory = opendir("Y:\\logs");流函数可以打开远程目录
\\smbserver\share\path\to\winfile.ext发布于 2009-03-16 23:06:39
尝试在<a href=...中使用file:///前缀,而不是http://前缀
https://stackoverflow.com/questions/638585
复制相似问题