dqsong2010 2009-07-20 14:11
浏览 75
已采纳

php访问Windows下的网络路径

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

  • 写回答

3条回答 默认 最新

  • doudong2149 2009-07-20 20:10
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分