PHP如何能得到BT下载后的中文名?? http://pear.php.net/package/File_Bittorrent2 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Pear里面有类库lz自己看看 分析.Bittorrent的文件格式,必定在一个固定的位置存放着文件名信息,然后把它匹配出来。 d8:announce32:http://tr.52bt.net:8080/announce10:created by13:BitComet/1.0613:creation datei1226511386e8:encoding3:GBK4:infod4:ed2k16:?D^挊=W詔喽?:filehash20:?A8髛宎L$I呱7傋6:lengthi5170248e4:name23:BitComet_1.06_setup.exe10:name.utf-823:BitComet_1.06_setup.exe12:piece lengthi32768e6:pieces3160:忍dw?斫熯凖AC阿`G?rd隽A監I嘩Kz5虠<^-UQ?dу_楝G?N's鯎嬟H即慷V#?醲这是一个.torrent文件。看到文件头的name23:BitComet_1.06_setup.exe了吗?23代表文件名长度是23个字符。所以你只需要匹配冒号后面的23个字符的字符串就可以了 看不懂英文的话,看看一下这些文件的代码,对你应该有帮助Decode.php torrentinfo.php scrape.php $contents = file_get_contents($torrent_filename);preg_match('/name(\d+)/is',$contents,$matchs);$length = $matchs[1];preg_match('/name'.$length.':(.{'.$length.'})/is',$contents,$matchs);$truename = $matchs[1];echo $truename;///////////////////////output:BitComet_1.06_setup.exe顺便请教个问题:想一步取出文件名,这样写正则为啥匹配不到结果。preg_match('/name(\d+):(.{\1})/is',$contents,$matchs);按理说\1应该被替换为(\d+)匹配到的值,但为啥不行,实在不解。所以只好分两步来做了。哪位达人知道请告知 $contents = file_get_contents($torrent_filename);preg_match('/name(\d+)/is',$contents,$matchs);$length = $matchs[1];preg_match('/name'.$length.':(.{'.$length.'})/is',$contents,$matchs);$truename = $matchs[1];echo $truename;///////////////////////output:BitComet_1.06_setup.exe顺便请教个问题:想一步取出文件名,这样写正则为啥匹配不到结果。preg_match('/name(\d+):(.{\1})/is',$contents,$matchs);按理说\1应该被替换为(\d+)匹配到的值,但为啥不行,实在不解。所以只好分两步来做了。哪位达人知道请告知 菜鸟apache配置问题 js中怎么调用php变量问题 求问怎么解决两个不在同一个库里的两个表的字段更新 用户登录问题 帮帮忙 大哥大姐们 smarty缓存问题请大家看一看 关于smarty的一个问题 同时执行两个数据库 100分急求一个页面刷新问题,谢谢!!! php 能不能调入 sql server 的存储过程? 如何在PHP中检测下拉框中改变选择的条目? 读取某个PHP页面执行后的页面内容并返回怎么搞啊? 引用函数的问题
lz自己看看
这是一个.torrent文件。看到文件头的name23:BitComet_1.06_setup.exe了吗?23代表文件名长度是23个字符。所以你只需要匹配冒号后面的23个字符的字符串就可以了
看不懂英文的话,
看看一下这些文件的代码,对你应该有帮助
Decode.php
torrentinfo.php
scrape.php
preg_match('/name(\d+)/is',$contents,$matchs);
$length = $matchs[1];
preg_match('/name'.$length.':(.{'.$length.'})/is',$contents,$matchs);
$truename = $matchs[1];
echo $truename;///////////////////////
output:BitComet_1.06_setup.exe
顺便请教个问题:想一步取出文件名,这样写正则为啥匹配不到结果。
preg_match('/name(\d+):(.{\1})/is',$contents,$matchs);
按理说\1应该被替换为(\d+)匹配到的值,但为啥不行,实在不解。所以只好分两步来做了。哪位达人知道请告知
preg_match('/name(\d+)/is',$contents,$matchs);
$length = $matchs[1];
preg_match('/name'.$length.':(.{'.$length.'})/is',$contents,$matchs);
$truename = $matchs[1];
echo $truename;///////////////////////
output:BitComet_1.06_setup.exe
顺便请教个问题:想一步取出文件名,这样写正则为啥匹配不到结果。
preg_match('/name(\d+):(.{\1})/is',$contents,$matchs);
按理说\1应该被替换为(\d+)匹配到的值,但为啥不行,实在不解。所以只好分两步来做了。哪位达人知道请告知