无法通过命令打开 openDir 打开共享文件夹


can not open the share folder via command openDir

我的网络共享空间上的命令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)

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

你可以试试这个:

<?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")
...
?>

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

奥彭迪尔