Esempio n. 1
0
/*
 * theme : 文件下载类
 * intro : 指定目录获取目录下的所有文件夹及子文件,实现下载功能
 * author / date : marvin / 2015-07-02
 */
error_reporting(E_ALL ^ E_NOTICE);
$array = ['app', 'x'];
$dir = new Checkout($array);
//下载文件
if (isset($_GET[option]) && $_GET['option'] != '') {
    $info = $dir->downLoad($_GET['option']);
    die;
}
//显示目录结构
$fileArray = $dir->showDir();
echo $dir->showHtml($fileArray);
/*
 * theme : 文件目录下载类
 * intro : 包含显示目录结构,遍历文件夹,下载文件,文件显示格式化,简单的html展示,访问限制
 * @parm :$dir array 目录名称
 * author / date : marvin / 2015-07-02
 */
class Checkout
{
    protected $dirArray;
    protected $host;
    public function __construct($dir)
    {
        header("Content-Type: text/html; charset=UTF-8");
        header("Cache-Control: no-store");