windows下php访问网络路径

php access network path under windows(windows下php访问网络路径)
本文介绍了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访问网络路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

In PHP how can you clear a WSDL cache?(在 PHP 中如何清除 WSDL 缓存?)
failed to open stream: HTTP wrapper does not support writeable connections(无法打开流:HTTP 包装器不支持可写连接)
Stop caching for PHP 5.5.3 in MAMP(在 MAMP 中停止缓存 PHP 5.5.3)
Caching HTTP responses when they are dynamically created by PHP(缓存由 PHP 动态创建的 HTTP 响应)
Memcached vs APC which one should I choose?(Memcached 与 APC 我应该选择哪一个?)
What is causing quot;Unable to allocate memory for poolquot; in PHP?(是什么导致“无法为池分配内存?在 PHP 中?)