映射的网络驱动器 [英] Mapped Network Drives

查看:284
本文介绍了映射的网络驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将网络驱动器映射到家庭网络中的计算机。现在我试图通过PHP来访问它 - 我做了这个快速测试:

  echo opendir('Z:\\ ); 

这给了我:

 警告:opendir(Z:\)[function.opendir]:未能打开dir:C:\ wamp \www\webs\tester-function.php 3 

我在这里做错了什么?

我不希望我的用户输入UNC路径,那么有没有办法让他们获得UNC路径,也许这将工作,当我试图访问它?这是可能的微软语言,但我不知道如何让PHP做到这一点 - 也许使用CMD.EXE命令?

请注意,映射的驱动器确实存在因为我可以看到它,我可以访问它。它也似乎不是一个权限问题,因为我假设它会抱怨这个如果它可以访问该驱动器...对吗?

感谢所有任何帮助

解决方案

用户opendir()的注释()有这样的:

lockquote

使用此opendir功能访问网络驱动器。我读了很多帖子,说几乎不可能访问网络驱动器,最后我找到了答案。在同一台机器或另一台机器上使用PHP访问网络驱动器有两个步骤。

在这种情况下,用户的权利似乎确实是问题,根据用户的PHP / Web服务器上运行,这可能会有所不同。


I have mapped a network drive to a computer in my home network. Now I am trying to access it via PHP - I did this quick test:

echo opendir('Z:\\');

This gives me:

Warning: opendir(Z:\) [function.opendir]: failed to open dir: No error in C:\wamp\www\webs\tester-function.php  on line 3

What have I done wrong here?

I don't want my users typing in the UNC path so is there a way to get the UNC path for them and maybe that will work when I try to access it? This is possible in Microsoft languages but I am not sure how to get PHP to do this - maybe using a cmd.exe command?

Please note, the mapped drive does exist as I can see it and I can access it. It also does not appear to be a permissions problem as I am assuming it would of complained about this IF it could access that drive...right?

Thanks all for any help

解决方案

The User Contributed Notes to opendir() have this:

I was trying to access network drives using this opendir function. I read so many posts saying that it was almost impossible to access a network drive and finally, I found the answer; there are 2 steps to be followed to access a network drive with PHP either on the same machine or another machine.

in this case, the user rights seemed indeed to be the problem, which can be different from your rights depending on what user PHP / the web server are running on.

这篇关于映射的网络驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆