windows下php访问网络路径

标签 php networking path dir

在安装在 Windows XP 计算机上的 PHP (XAMPP) 中,我正在尝试读取本地网络服务器上存在的目录。我正在使用 is_dir() 来检查它是否是我可以读取的目录。

在 Windows 资源管理器中,我键入 \\\server\dir 并显示该目录。 当我映射网络驱动器时,a 也可以使用 z:\dir 访问它。

在 PHP 中我有那个脚本:

<?php if( is_dir($dir){ echo 'success' } ) ?>

对于 $dir 我试过:

  • /server/dir
  • //server/dir
  • \server\dir
  • \\server\dir
  • \\\\server\\dir

  • z:\dir
  • z:\\dir
  • z:/目录
  • z://目录

但是我从来没有成功过? 任何想法? 谢谢

最佳答案

我通过更改服务器注册表中的一些内容解决了这个问题,如本次讨论的最后一个答案中所述:

http://bugs.php.net/bug.php?id=25805

无论如何都要感谢 VolkerK 和 Gumbo! 我喜欢 stackoverflow 和他们的好人,他们帮助你的速度非常快!!

编辑(取自 php.net):

The service has limited access to network resources, such as shares and pipes, because it has no credentials and must connect using a null session. The following registry key contains the NullSessionPipes and NullSessionShares values, which are used to specify the pipes and shares to which null sessions may connect: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters Alternatively, you could add the REG_DWORD value RestrictNullSessAccess to the key and set it to 0 to allow all null sessions to access all pipes and shares created on that machine.`

将 RestrictNullSessAccess=0 添加到您的注册表。

关于windows下php访问网络路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1153824/

相关文章:

php - 如何用数据库表的下一个 blob 条目替换 blob 中的单词

networking - 计算机的IP地址

java - 通过交叉连接进行 UDP 广播

php - XAMPP 相对 URL 无法正常工作

PHP Mysql 数据整理

python - 如何只获取父目录的名称,而不是完整路径?

java - 读取java中另一个包中的图像路径

android - 如何调整路径大小?

php - 正确使用 session_set_cookie_params

python - 基于字符串的协议(protocol)安全基础