php 权限验证的方式,进行 文件下载 (可以进行登陆用户等验证)

技术分享 · Fecmall · 于 4年前 发布 · 1277 次阅读

转载地址:http://www.phpweblog.net/phpbaby/archive/2012/07/10/7709.html

		$filePath = Yii::$service->image->GetZipDir('/4/5c/45clz1y4cvbnw23tp05i1566131514.zip');
        
        $file_fullpath = $filePath;
        header("Content-Type: application/octet-stream");
        header('Content-Disposition: attachment; filename="addons.zip"');//文件描述,页面下载用的文件名,可以实现用不同的文件名下载同一个文件
        
        $data = fopen($file_fullpath, 'rb');
        while (!feof($data)) {
                echo @fread($data, 8192);
                flush();
                ob_flush();
        }
        fclose($data);
共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics