php读取torrent种子文件内容的方法(测试可用)_

php读取torrent种子文件内容的方法(测试可用)_

ID:63497653

大小:13.35 KB

页数:10页

时间:2021-08-24

php读取torrent种子文件内容的方法(测试可用)__第1页
php读取torrent种子文件内容的方法(测试可用)__第2页
php读取torrent种子文件内容的方法(测试可用)__第3页
php读取torrent种子文件内容的方法(测试可用)__第4页
php读取torrent种子文件内容的方法(测试可用)__第5页
资源描述:

《php读取torrent种子文件内容的方法(测试可用)_》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、php读取torrent种子文件内容的方法(测试可用)_这篇文章主要介绍了php读取torrent种子文件内容的方法,可实现读取并显示torrent种子文件内容的功能,简洁有用,需要的伴侣可以参考下?php/***ClassxBEncoder*Author:Angus.Fenying*Version:0.1*Date:2021-06-03**ThisclasshelpsstringifyorparseBENC*codes.**AllCopyrights2021-2021FenyingStudioReserved.*/classxBEncoder{constREADY=0;constREAD_

2、STR=1;constREAD_DICT=2;constREAD_LIST=3;constREAD_INT=4;constREAD_KEY=5;public$y;protected$z,$m,$n;protected$stat;protected$stack;/***Thismethodsavesthestatusofcurrent*encode/decodework.*/protectedfunctionpush($newY,$newStat){array_push($this-stack,array($this-y,$this-z,$this-m,$this-n,$this-stat))

3、;list($this-y,$this-z,$this-m,$this-n,$this-stat)=array($newY,0,0,0,$newStat);}/***Thismethodrestorethesavedstatusofcurrent*encode/decodework.*/protectedfunctionpop(){$t=array_pop($this-stack);if($t){if($t[4]==self::READ_DICT){$t[0]-{$t[1]}=$this-y;$t[1]=0;}elseif($t[4]==self::READ_LIST)$t[0][]=$th

4、is-y;list($this-y,$this-z,$this-m,$this-n,$this-stat)=$t;}}/***Thismethodinitializesthestatusofwork.*YOUSHOULDCALLTHISMETHODBEFOREEVERYTHING.*/publicfunctioninit(){$this-stat=self::READY;$this-stack=array();$this-z=$this-m=$this-n=0;}/***Thismethoddecode$s($laslength).*Youcanget$obj-yastheresult.*/

5、publicfunctiondecode($s,$l){$this-y=0;for($i=0;$i$l;++$i){switch($this-stat){caseself::READY:if($s[$i]=='d'){$this-y=newxBDict();$this-stat=self::READ_DICT;}elseif($s[$i]=='l'){$this-y=array();$this-stat=self::READ_LIST;}break;caseself::READ_INT:if($s[$i]=='e'){$this-y-val=substr($s,$this-m,$i-$thi

6、s-m);$this-pop();}break;caseself::READ_STR:if(xBInt::isNum($s[$i]))continue;if($s[$i]=':'){$this-z=substr($s,$this-m,$i-$this-m);$this-y=substr($s,$i+1,$this-z+0);$i+=$this-z;$this-pop();}break;caseself::READ_KEY:if(xBInt::isNum($s[$i]))continue;if($s[$i]=':'){$this-n=substr($s,$this-m,$i-$this-m);

7、$this-z=substr($s,$i+1,$this-n+0);$i+=$this-n;$this-stat=self::READ_DICT;}break;caseself::READ_DICT:if($s[$i]=='e'){$this-pop();break;}elseif(!$this-z){$this-m=$i;$this-stat=self::READ_KEY;break;}caseself::

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。