其实迅雷的thunder://
地址就是将普通 url 地址加前缀 AA
、后缀ZZ
,再 base64 编码后得到的字符串
普通 url 转 thunder
1function ThunderEncode($url) {
2 $thunderPrefix="AA";
3 $thunderPosix="ZZ";
4 $thunderTitle="thunder://";
5 $thunderUrl=$thunderTitle.base64_encode($thunderPrefix.$url.$thunderPosix);
6 return $thunderUrl;
7}
thunder 转普通 url
1function ThunderDecode($thunderUrl) {
2 $thunderPrefix="AA";
3 $thunderPosix="ZZ";
4 $thunderTitle="thunder://";
5 $url=substr(trim($thunderUrl),10);
6 $url=base64_decode($url);
7 $url=substr($url,2,-2);
8 return $url;
9}