1

我的网络共享空间上的命令 openDir 有问题

利用:

openDir( '\\\\172.17.50.8\tsbnb_rw' );

错误如下:

Warning: opendir(\\172.17.50.8\tsbnb_rw,\\172.17.50.8\tsbnb_rw) [function.opendir]: Access is denied. (code: 5)

此共享文件夹需要授权用户和密码,但我不知道如何设置。

4

2 回答 2

1

You can try this:

<?php

// Define the parameters for the shell command
$location = "\\servername\sharename";
$user = "USERNAME";
$pass = "PASSWORD";
$letter = "Z";

// Map the drive
system("net use ".$letter.": \"".$location."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");

// Open the directory
$dir = opendir($letter.":/an/example/path")

...

?>
于 2013-10-09T07:53:23.370 回答
0

尝试阅读手册;对于 linux 下的 samba,这里有一个例子:

打开目录

于 2013-10-09T07:57:27.313 回答