0

磁铁链接:

magnet:?xt=urn:btih:8fe65e43464debe1bc0961e4656ea780368d4fba&dn=A+Goofy+Movie+%281995%29+720p+HDTVRip+x264+Eng+Subs+%5BDual+Audio%5D+%5BHindi+DD+2.0+-+English+DD+2.0%5D+Exclusive+By+-%3D%21Dr.STAR%21%3D-&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fzer0day.to%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce

我的问题是如何检查此链接在 PHP 中是否有效

抱歉,我是编码新手,对编码了解不多

4

1 回答 1

2

对于 PHP,可以这样做:

$str = 'magnet:?xt=urn:btih:74651f66e937698dc5ac1e0e252f44795070a7b5&dn=archlinux-2017.03.01-dual.iso&tr=udp://tracker.archlinux.org:6969&tr=http://tracker.archlinux.org:6969/announce';

if(preg_match('/magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}/', $str)){
  echo 'valid';
}

但这仅检查格式是否有序,除非您尝试一下,否则您不知道磁力链接是否有效。

于 2017-03-26T18:09:17.040 回答