 
- 帖子
- 112
- 积分
- 764
- 金钱
- 113
- 在线时间
- 103 小时
- 注册时间
- 2011-3-5
- 最后登录
- 2012-11-29
|
本帖最后由 12395874 于 2012-2-18 20:51 编辑
如果你希望和我所示例的一样是 域名/vdisk/提取码/文件名.后缀
请将上面的代码第9行改为- preg_match("/vdisk\/(.+)\//",$uri,$code)
复制代码
即整个代码为
-
- <?php
- /*
- *使用说明:你的域名/vdisk/提取码/文件名.后缀
- *如http://www.vdisk.cn/down/index/9627346A7426则提取码为9627346A7426
- *Time:2012.12.18 侠客
- */
- error_reporting(0);
- $uri = $_SERVER["REQUEST_URI"];
- preg_match("/vdisk\/(.+)\//",$uri,$code);
- $code = $code[1];
- $opts = array(
- 'http'=>array('method'=>"GET",'header'=>"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.3)\r\n")
- );
- $context = stream_context_create($opts);
- $url = "http://www.vdisk.cn/down/index/".$code;
- $data = file_get_contents($url,false,$context);
- preg_match("/name=.httpfileurl..content=.(.*?).>/", $data, $data);
- $myurl = $data[1];
- if($myurl){
- header('Content-Type:application/force-download');
- header("Location:".$myurl);
- die();
- }
- else
- echo "参数错误";
- ?>
复制代码
只是这样当然还是不行的,然后还需要你进行伪静态处理
编辑网站目录下.htaccess文件
加上这句
- RewriteRule ^vdisk\/(.+)$ vdisk.php/$1
复制代码
如果你的.htaccess文件没有这句还请再加上这句,将 RewriteEngine 模式打开
好了现在你也可以跟我一样这样使用网盘 |
|