简体   繁体   English

使用php open dir访问网络驱动器

[英]accessing network drive with php open dir

I have a flash drive(or hdd) connected to Linksys Router and set it up for access without login.我有一个闪存驱动器(或硬盘)连接到 Linksys 路由器并设置为无需登录即可访问。 Then I setup netword drive at Computer(Windows 7 Proffesional x64).然后我在计算机(Windows 7 Proffesional x64)上设置网络驱动器。 I tried opendir(\\192.168.1.1);我试过 opendir(\\192.168.1.1); but i'm getting this error但我收到这个错误

 Warning: opendir(\\192.168.1.1\s2,\\192.168.1.1\s2): The network name cannot be found.       (code: 67) in C:\xampp\htdocs\movies.php on line 4
 Warning: opendir(\\192.168.1.1\s2): failed to open dir: No such file or directory in C:\xampp\htdocs\movies.php on line 4
 Warning: readdir() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\movies.php on line 5

Then I tried couple of tips at php.net opendir comments, but when i tried to log on apache as my account I'm geeting error :然后我在 php.net opendir 评论中尝试了几个技巧,但是当我尝试以我的帐户登录 apache 时,我遇到了错误:

Windows could not start the apache2.4 service on Local Computer Error 1069: The service did not start due to a logon failure.

The PHP Code: PHP代码:

$path = '\\192.168.1.1\\s2';
$dir = opendir($path);
while($temp = readdir($dir))echo $temp;

EDIT : well i made apache to log on an admistrator account that i created specialy for this purpose, but still i'm getting this error:编辑:好吧,我让 apache 登录我专门为此目的创建的管理员帐户,但我仍然收到此错误:

Warning: opendir(\\192.168.1.1\s2\,\\192.168.1.1\s2\): The network name cannot be found. (code: 67) in C:\xampp\htdocs\movies.php on line 4

\\192.168.1.1 is invalid address for network share. \\192.168.1.1是无效的网络共享地址。 Have you tried \\\\192.168.1.1 ?你试过\\\\192.168.1.1吗?

And in both cases you should escape that \\ and write the address as a proper string with quotation marks.在这两种情况下,您都应该转义\\并将地址写为带引号的正确字符串。

Also, \\\\192.168.1.1 alone is not "a valid folder", you have to specify one of the network shares under this IP address.此外,单独的\\\\192.168.1.1不是“有效文件夹”,您必须在此 IP 地址下指定网络共享之一。

That being said, you should use opendir("\\\\\\\\192.168.1.1\\\\share") .话虽如此,您应该使用opendir("\\\\\\\\192.168.1.1\\\\share")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM