帖子内包含图片,需登陆后查看高清大图
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
国内网盘竞相扩容,不断满足网友文件存储需求,下面代码可以转换百度网盘分享文件直接外链下载,更方便在论坛或个人博客中分享你的下载文件.
使用:复制下面2段代码,第一段保存为html文件,第二段保存为baidupan.php文件,上传自己的空间个人php网站上.
分享文件后缀可自定义。
演示:http://www.zairun.com/wangpan/
[HTML] 纯文本查看 复制代码 <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>百度网盘文件永久外链</title>
<link href="http://libs.baidu.com/bootstrap/2.0.4/css/bootstrap.min.css" type="text/css" rel="stylesheet" media="screen" />
<style type="text/css">
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
.form_pan {
max-width: 650px;
padding: 19px 29px 29px;
margin: 0 auto 20px;
background-color: #fff;
border: 1px solid #e5e5e5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.form_pan .form_pan-heading {
margin-bottom: 10px;
}
</style>
</head>
<script type="text/javascript">
function Change()
{
var host = window.location.host;
var url = document.getElementById("text1").value;
var arr = url.split("&");
var shareid = arr[0].split("=")[1];
var uk = arr[1].split("=")[1];
var file_value = "";
var file_type = document.getElementsByName("file_type");
for (var i = 0; i < file_type.length; i++) {
if (file_type[i].checked) {
file_value = file_type[i].value;
break;
}
};
var file_other = document.getElementById("file_other");
file_other_text = document.getElementById("file_other_text");
if (file_value == 'other') {
if (file_other_text.value.length == 0) {
alert("扩展名不能为空!");
inputUrl.focus();
return false;
}
//outputUrl.value = hostname + abc + "." + file_other_text.value;
var songurl = "http://"+host+"/baidupan.php/"+shareid+"/"+uk + "."+file_other_text.value;
document.getElementById("text2").value = songurl;
} else {
//outputUrl.value = hostname + abc + "." + file_value;
var songurl = "http://"+host+"/baidupan.php/"+shareid+"/"+uk+"." + file_value;
document.getElementById("text2").value = songurl;
}
//var songurl = "http://linuxlib.org/baidupan.php/"+shareid+"/"+uk+".mp3";
//document.getElementById("text2").value = songurl;
}
function fileOtherTextChange() {
if (file_other.checked == true) {
file_other_text.disabled = false;
file_other_text.focus();
} else {
file_other_text.disabled = true;
}
}
</script>
<body>
<div class='container'>
<form class="form_pan" id="pan_form">
<h2 class="form_pan-heading">百度网盘文件永久外链</h2><p>
分享地址:<input id="text1" type="TEXT" value="" style="width:550px;" size=""/><br />
外链地址:<input id="text2" type="TEXT" value="" style="width:550px;" size=""/><br />
<p>
文件的扩展名:
<input type="radio" class="radio" name="file_type" id="file_mp3" value="mp3" checked />
mp3
<input type="radio" class="radio" name="file_type" id="file_png" value="png" />
png
<input type="radio" class="radio" name="file_type" id="file_exe" value="exe" />
exe
<input type="radio" class="radio" name="file_type" id="file_zip" value="zip" />
zip
<input type="radio" class="radio" name="file_type" id="file_mp4" value="mp4" />
mp4
<input type="radio" class="radio" name="file_type" id="file_other" value="other" />
其他格式
<input type="text" class="input-medium search-query" style="width:80px;" id="file_other_text" disabled />
</p>
<input type="BUTTON" value="转换"/>
</div>
</body>
</html>
首先复制下面的php代码,另存为文件baidupan.php,然后将php文件放到网站根目录。
游客,本帖隐藏的内容需要积分高于 2 才可浏览,您当前积分为 0
本文转载自 载润的博客
该贴已经同步到 湖南站长站的微博 |