首页> 实战笔录 >PHP开发笔记 >PHP PHP

PHP网页调用迅雷下载文件

作者:小萝卜 2019-07-23 浏览 2101

简介PHP实现迅雷下载文件

后端php代码:

//将链接转化成迅雷的下载资源链接
function ThunderEncode($url, $type='en') {
  if($type =='en'){
    return "thunder://".base64_encode("AA".$url."ZZ");
  }else{
    return substr(base64_decode(substr(trim($url),10)),2,-2);
  }
}

$url = 'http://www.luowebs.com/uploads/20190722/46479528965.mp4'; //url例子
$thunderUrl = ThunderEncode("http://请改成你需要的链接.rar"); 


前端代码:

< SCRIPT src="http://pstatic.xunlei.com/js/webThunderDetect.js">< /SCRIPT>
< a oncontextmenu=ThunderNetwork_SetHref(this) onclick="return OnDownloadClick_Simple(this,2,4)" href="#" thunderResTitle="下载资源名" thunderType="" thunderPid="52345834" thunderHref="< ?php echo $thunderUrl;? >" >迅雷专用高速下载< /a>
 

很赞哦! (0)

文章评论

    高端网站建设