PHP Array工作作业

时间:2016-07-31 11:29:43

标签: php arrays

我在PHP数组中有学习功课,但有一些问题。我写了一个torrent文件信息检查器。

我的代码:echo var_dump( $torrent->content() );

输出:array(1) { ["Mac OS X El Capitan 10.11.4 (15E65) Installer/Install OS X El Capitan.app.zip"]=> int(6205991074) }

如何列出:

Mac OS X El Capitan 10.11.4 (15E65) Installer/Install OS X El Capitan.app.zip
<br>And More files...

另外列出了哪些列表统计信息: 我的代码:echo var_dump( $torrent->scrape() );

输出:

array(1) { ["Mac OS X El Capitan 10.11.4 (15E65) Installer/Install OS X El Capitan.app.zip"]=> int(6205991074) } 
stats: array(1) { ["http://109.235.50.166:2710/scrape"]=> array(3) { ["complete"]=> int(98) ["downloaded"]=> int(11441) ["incomplete"]=> int(27) } } 

我如何命令:

Downloaded: 11441
Downloading: 27

谢谢伙伴们!

1 个答案:

答案 0 :(得分:0)

尝试这样的事情: -

List Of Files:-


foreach($torrent->content() as $key => $value){
   echo $key."<br/>";
}

Status:-

foreach($torrent->scrape() as $key => $value){
   echo "Downloaded:" $value['downloaded']."<br/>";
   echo "Downloading:" $value['incomplete']."<br/>";
}