使用PHP如何将普通url下载地址与迅雷下载地址thunder://相互转换

  • A+
所属分类:Other

普通url转thunder

<?php
function ThunderEncode($url) {
 $thunderPrefix="AA";
 $thunderPosix="ZZ";
 $thunderTitle="thunder://";
 $thunderUrl=$thunderTitle.base64_encode($thunderPrefix.$url.$thunderPosix);
 return $thunderUrl;
}
?>

thunder转普通url

<?php
function ThunderDecode($thunderUrl) {
$thunderPrefix="AA";
$thunderPosix="ZZ";
$thunderTitle="thunder://";
$url=substr(trim($thunderUrl),10);
$url=base64_decode($url);
$url=substr($url,2,-2);
return $url;
}
?>

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: