windows下php访问网络路径 [英] php access network path under windows

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

问题描述

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

within PHP (XAMPP) installed on a Windows XP Computer Im trying to read a dir which exists on a local network server. Im using is_dir() to check whether it is a dir that I can read.

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

In Windows Explorer I type \serverdir and that dir is being shown. When I map a network drive a can access it with z:dir as well.

在 PHP 中我有那个脚本:

In PHP I have that script:

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

对于 $dir 我试过:

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

  • z:dir
  • z:\dir
  • z:/dir
  • z://dir

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

But I never get success? Any idea? thx

推荐答案

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

I solved it by changing some stuff in the registry of the server as explained in the last answer of this discussion:

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

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

Thanks to VolkerK and Gumbo anyway! I love stackoverflow and their great people who help you so incredibly fast!!

编辑(取自 php.net):

EDIT (taken from php.net):

该服务对网络资源的访问受限,例如共享和管道,因为它没有凭据并且必须使用 null 进行连接会议.以下注册表项包含 NullSessionPipes 和NullSessionShares 值,用于指定管道和空会话可以连接到的共享:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters或者,您可以添加 REG_DWORD 值RestrictNullSessAccess 键值,设置为 0 允许所有空值会话以访问在该机器上创建的所有管道和共享.`

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_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters 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 添加到您的注册表中.

add RestrictNullSessAccess=0 to your registery.

这篇关于windows下php访问网络路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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