【问题标题】:Trying to access a windows shared folder through php (laravel) on a linux machine using scandir尝试使用scandir在linux机器上通过php(laravel)访问windows共享文件夹
【发布时间】:2015-08-14 19:17:22
【问题描述】:

大家下午好,我正在尝试使用scandir方法通过php(laravel)访问同一网络上的Windows共享文件夹。这是一些示例代码

$dir = '\\\\192.168.1.18\\Data';
$files = scandir($dir);
return $files;

我尝试了不同的方法来输入服务器地址(\192.168.1.18\Data 等等)。

我收到了scandir(\\192.168.1.18\Data): failed to open dir: No such file or directory

提前致谢

【问题讨论】:

    标签: php laravel scandir network-share


    【解决方案1】:

    您可以通过用这个简单的 linux 命令替换 scandir 来检查共享文件夹或 PHP 是否有问题:

    exec("ls \\\\192.168.1.18\\Data",$result);
    print_r($result);
    

    如果您收到错误没有这样的文件或目录,那么您的共享文件夹有问题。

    【讨论】:

      【解决方案2】:

      我认为this question 可能会对您有所帮助。它建议在 Linux 中挂载 Windows 共享。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-01-04
        • 1970-01-01
        • 1970-01-01
        • 2016-07-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多