简介
h5ai是一款功能强大的php文件目录列表程序,它提供多种文件目录列表呈现方式,支持Apache httpd, lighttpd, nginx等多种web服务器,支持多国语言(如英语,简体中文等),你可以在线预览txt,图片,音频,视频等文件格式。

h5ai官网:https://larsjung.de/h5ai/

截图
请输入图片描述

安装
要求:PHP 5.5+

1、搭建php网站环境
可使用军哥的lnmp、lamp一键包或者amh、vestacp、宝塔等面板程序搭建。

2、上传h5ai文件到网站根目录
h5ai本地下载地址:h5ai-0.29.0.zip,将文件解压后放在网站根目录。

3、修改配置文件
只需要在配置文件某个地方加上/_h5ai/public/index.php即可,比如:
Apache httpd 2.2 / 2.4:httpd.conf

DirectoryIndex  index.html  index.php  /_h5ai/public/index.php

lighttpd 1.4:lighttpd.conf

index-file.names += ("index.html", "index.php", "/_h5ai/public/index.php")

nginx 1.2:nginx.conf

index  index.html  index.php  /_h5ai/public/index.php;

最后重启服务器即可!并将要共享的文件均放到根目录(与_h5ai同一目录下)。

注意
如果存在文件,但读不出来,可能原因就是php已禁用scandir函数了,请修改php.ini解决。

disable_functions=passthru,exec,system,chroot,scandir,...

删掉scandir,字样,再重启php即可:/etc/init.d/php-fpm restart。

把h5ai程序_h5ai中privatepublic两个文件夹中的cache目录权限设置为777。

开启二维码、搜索、选择功能
方法
以下均在配置文件/www.xx.com/_h5ai/private/conf/options.json修改

1、开启选择功能

"select": {
        "enabled": false,
        "clickndrag": true,
        "checkboxes": true
    },

将false修改为true,即:

"select": {
        "enabled": true,
        "clickndrag": true,
        "checkboxes": true
    },

该功能可方便我们进行批量下载。

2、开启搜索功能

"search": {
        "enabled": false,
        "advanced": true,
        "debounceTime": 300,
        "ignorecase": true
    },

将false修改为true,即:

"search": {
        "enabled": true,
        "advanced": true,
        "debounceTime": 300,
        "ignorecase": true
    },

开启后我们可以更快的找到文件了。

3、开启二维码功能

"info": {
        "enabled": false,
        "show": false,
        "qrcode": true,
        "qrFill": "#999",
        "qrBack": "#fff"
    },

将false修改为true,即:

"info": {
        "enabled": true,
        "show": true,
        "qrcode": true,
        "qrFill": "#999",
        "qrBack": "#fff"
    },

原文地址

Last modification:December 29, 2021
If you think my article is useful to you, please feel free to appreciate