我对 opendir 有一个奇怪的问题(与 glob 相同的问题):
$dir = "Y:\\\\foldername\\";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file\n";
}
closedir($dh);
}
}
Y:\ 是具有身份验证的网络文件夹。我的网络服务器名称是 testweb,这个脚本叫做 tree.php。不幸的是,我的环境是基于 Windows 的(php 5.2.5 ISAPI,Windows 2003 服务器)。
当我从运行 IIS 的同一台机器(http://testweb/tree.php)打开脚本时,一切正常,但是如果我从另一台机器(例如我的笔记本电脑)连接到相同的地址,我会收到以下错误:
警告:opendir().. 未能打开目录。D:\web\tree.php 中没有错误
这似乎是一个权限问题,但为什么它是从“本地机器”而不是从外部工作?我怎样才能解决这个问题?
谢谢你的帮助!!