html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <a href="downdo.php?f=7337e2f117b38edd90ef8ddd50c31406">宝宝图片下载</a> <a href="downdo.php?f=3c78b35502b2693fefdfc51cba3a53a5">php手册下载</a> <a href="downdo.php?f=bdd5af62d46f0222f61908a1cff92f16">教学视频下载</a> </body> </html>
php页面
<?php $file = $_GET['f']; $arr = [ '7337e2f117b38edd90ef8ddd50c31406' => ['./images/baobao.jpg' , '宝宝图片.jpg'], '3c78b35502b2693fefdfc51cba3a53a5' => ['./images/manual.rar' , 'php手册.rar'], 'bdd5af62d46f0222f61908a1cff92f16' => ['./images/stu.avi' , '视频教程.avi'] ]; //告诉浏览器内容类型为8位的二进制数据流 header("Content-Type:application/octet-stream"); //告诉浏览器的数据处置方式,为附件方式保存 header("Content-Disposition:attachment;filename=". iconv('utf-8','gbk', $arr[$file][1])); $handle = fopen($arr[$file][0],'rb');//var_dump()打印看看,果然有resource文件,没问题 while($str = fread($handle,1024) ) { echo $str; }
其中 7337e2f117b38edd90ef8ddd50c31406 这些是MD5加密后的数据.
点击后