我如何在PHP中单独附加标签?

时间:2018-03-19 01:21:07

标签: php arrays id3

如何更改以下代码,而不是将文件的所有标记附加在一起,而是单独存储每个单独的标记,例如“标题”将存储在$ title中?因为目前所有的标签都存储在$ aTags

代码:

// gathering all mp3 files in 'mp3' folder into array
$sDir = 'mp3/';
$aFiles = array();
$rDir = opendir($sDir);
if ($rDir) {
while ($sFile = readdir($rDir)) {
    if ($sFile == '.' or $sFile == '..' or !is_file($sDir . $sFile))
        continue;

    $aPathInfo = pathinfo($sFile);
    $sExt = strtolower($aPathInfo['extension']);
    if ($sExt == 'mp3') {
        $aFiles[] = $sDir . $sFile;
  }
}
closedir($rDir);
}

// new object of our ID3TagsReader class
$oReader = new ID3TagsReader();

// passing through located files ..
$sList = $sList2 = '';
foreach ($aFiles as $sSingleFile) {
$aTags = $oReader->getTagsInfo($sSingleFile); // obtaining ID3 tags info
$sList .= '<tr><td>'.$aTags['Title'].'</td><td>'.$aTags['Album'].'</td>
<td>'.$aTags['Author'].'</td>
                <td>'.$aTags['AlbumAuthor'].'</td>
<td>'.$aTags['Track'].'</td><td>'.$aTags['Year'].'</td>
                <td>'.$aTags['Lenght'].'</td><td>'.$aTags['Lyric'].'</td>
<td>'.$aTags['Desc'].'</td>
                <td>'.$aTags['Genre'].'</td></tr>';


}

0 个答案:

没有答案