PHP访问网络共享目录fs1的00skap子文件夹内容遇问题求助
网络共享目录PHP遍历与访问链接问题求助
我需要通过PHP访问网络共享服务器fs1上00skap子文件夹的内容,使用DirectoryIterator遍历目录并生成访问链接,但遇到以下问题:
- 测试第一种echo生成的链接时,点击出现404-文件或目录未找到错误
- 测试第二种echo方式时,页面长时间加载后直接崩溃
- PHP错误日志更新异常,无法稳定获取报错信息
- 后续发现
web.config文件存在「无法读取配置文件,权限不足」的配置错误,但我确认路径正确且权限无问题,已排查数小时仍未解决
PHP代码:
<!DOCTYPE html> <html> <body> <h1>Images</h1> </body> <?php $dirs = '\\\fs1\images\00skap'; $dir = new DirectoryIterator($dirs); foreach ($dir as $fileinfo) { if ($fileinfo->isDir() && !$fileinfo->isDot()) { $fileinfo->getFilename().'<br>'; echo "<font color='red'><a href=\\fs1\images\00skap/$fileinfo\" style='color:#f9c539' >$fileinfo</a></br></font>"; //echo "<button onclick=\"location.href='/////fs1/images/00skap/$fileinfo'\">$fileinfo</button><br>"; } }
web.config内容:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <remove name="FastCGI" /> <add name="FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe" resourceType="File" /> </handlers> </system.webServer> </configuration>
内容的提问来源于stack exchange,提问作者Gummi
相关产品推荐
相关产品推荐

