php访问Windows下的网路 [英] php access network path under windows
问题描述
我试图读取本地网络服务器上存在的目录。我使用 is_dir()
来检查是否是可以阅读的目录。
在Windows资源管理器中,我键入 \\\\server\dir
,并显示该目录。
当我映射网络驱动器时,可以使用 z:\dir
访问它。
在PHP中我有这个脚本:
<?php if(is_dir($ dir){echo'success'}) ?>
对于 $ dir
我试过: p>
-
/ server / dir
-
// server / dir
-
\server\dir
-
\\server\dir
-
\\\\ \\\server\\dir
和
-
z:\dir
-
z: \\\dir
-
z:/ dir
-
z:// dir
但是我从来没有获得成功?
任何想法?
thx
我通过在服务器的注册表中更改一些东西来解决它,这个讨论:
http: //bugs.php.net/bug.php?id=25805
感谢VolkerK和Gumbo!
我喜欢stackoverflow和他们的伟大的人谁帮助你如此难以置信的快速!
编辑(取自php.net):
该服务对网络资源的访问受限,例如共享
和管道,因为它没有凭据,必须使用null
会话进行连接。以下注册表项包含NullSessionPipes和
NullSessionShares值,用于指定空会话可能连接的管道和
共享:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\\ \\ LanmanServer\Parameters
或者,您可以将REG_DWORD值
RestrictNullSessAccess添加到该键,并将其设置为0,以允许所有空
会话访问在该计算机上创建的所有管道和共享。 `
将RestrictNullSessAccess = 0添加到您的注册。
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.
In Windows Explorer I type \\\server\dir
and that dir is being shown.
When I map a network drive a can access it with z:\dir
as well.
In PHP I have that script:
<?php if( is_dir($dir){ echo 'success' } ) ?>
For $dir
I tried:
/server/dir
//server/dir
\server\dir
\\server\dir
\\\\server\\dir
and
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
Thanks to VolkerK and Gumbo anyway! I love stackoverflow and their great people who help you so incredibly fast!!
EDIT (taken from 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.`
add RestrictNullSessAccess=0 to your registery.
这篇关于php访问Windows下的网路的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!