首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从intranet使用scandir

无法从intranet使用scandir
EN

Stack Overflow用户
提问于 2012-09-11 04:37:46
回答 1查看 758关注 0票数 2

我正在尝试使用scandir()来获取目录的文件列表。

代码语言:javascript
复制
<?php
function getFileList($directory) {
    //Get the listing of the files/folders within the directory, place into an array.
    $files = scandir($directory);
    //Remove . and .. from the array.
    unset($files[0]);
    unset($files[1]);
    //Reindex array.
    $files = array_values($files);

    return $files;
}

$directory = '//192.168.1.20/is/Vendors/DavLong/Krames/';
    $files = getFileList($directory);

?>

当从我的本地机器(192.168.1.165)运行时,使用此代码效果很好,但是当通过公司内部网(192.168.1.35)运行时,我得到以下警告,使我的脚本无法运行:

代码语言:javascript
复制
Warning: scandir(//192.168.1.20/is/Vendors/DavLong/Krames/) [function.scandir]: failed to open dir: Invalid argument in C:\Inetpub\wwwroot\DocumentPrint\index.php on line 4

Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\Inetpub\wwwroot\DocumentPrint\index.php on line 4

Warning: array_values() [function.array-values]: The argument should be an array in C:\Inetpub\wwwroot\DocumentPrint\index.php on line 9

当使用192.168.1.35框时,我可以在windows的运行对话框中输入//192.168.1.20/is/Vendors/DavLong/Krames/,它确实会在适当的位置打开Windows资源管理器,这样机器就能够找到所请求的地址。

有没有人能帮我弥补一下,让它在本地和通过内联网工作。提前感谢您可能提供的任何有关情况的信息。

EN

回答 1

Stack Overflow用户

发布于 2012-09-11 04:43:01

我不知道如何通过这样的网络读取文件夹,但您是否可以映射一个网络驱动器,并在该驱动器上尝试scandir()?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12359071

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档