过去我通过 vmware 使用我的 PHP 代码,但我最近决定切换到通过 WAMP(在 Windows 8.1 上)在本地执行。
- 我在
www
文件夹中创建了一个空文件夹tests
。 - 然后在浏览器中输入
http://localhost/tests
除了不显示图标外,一切都很好。这是一张展示我的意思的图片:
有没有办法让这些图标正确显示?
最佳答案
这与 Apache 索引器配置文件有关。这是 Wamp 安装程序的错误。它不会修改 httpd-autoindex.conf 配置文件以指向您指定的 Wamp 目录。
查看 httpd-autoindex.conf 并将路径更改为指向图标所在的位置。在我的 WampServer 上,它们位于 c:/wamp/bin/apache/apache2.4.9/icons。
这是您需要更改的 httpd-autoindex.conf 的相关区域:
#Comment out and change below to appropriate icon path
#Alias /icons/ "c:/Apache24/icons/"
Alias /icons/ "c:/wamp/bin/apache/apache2.4.9/icons/"
#Comment out and change below to appropriate icon path
#Directory "c:/Apache24/icons">
<Directory "c:/wamp/bin/apache/apache2.4.9/icons/">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
默认情况下,WampServer 应该已经在 httpd.conf 中启用了精美的目录列表。如果它们被注释掉,启用它们:
LoadModule autoindex_module modules/mod_autoindex.so
Include conf/extra/httpd-autoindex.conf
不要忘记在进行这些更改后重新启动 Apache。
关于php - WAMP 不显示目录列表中的图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28131555/