简体   繁体   English

获取mp3文件元数据

[英]Getting mp3 file metadata

I am a bit new to id3 tags and forgive me for the question is too basic.What's a quick and easy way to get ALL ID3 tags (artist, album, etc.) using php/javascript(client side preffered)? 我对id3标签有点陌生,请原谅我这个问题太基本了。用php / javascript(带客户端功能)获取所有 ID3标签(艺术家,专辑等)的快速简便的方法是什么?

I used this code but it ends up outputting nothing. 我使用了这段代码,但最终却什么也没输出。

<html>
<body>
<?php
$tag = id3_get_tag( "lolwa.mp3" );
print_r($tag);
?>
</body> 
</html>

I know I have to include the ID3v2 library but am confused how exactly to include it.And will including it sove the problem of getting all ID3 tags like: 我知道我必须包括ID3v2库,但对于如何准确地包含它感到困惑,并且将其包含在内解决了所有 ID3标签的问题:

  • bitrate 比特率
  • comments 评论
  • duration etc. 持续时间等

Thanks a lot! 非常感谢!

PS- I have included the mp3 file(lolwa.mp3) just next to my code(in the same folder). PS-我在我的代码旁边(在同一文件夹中)包含了mp3文件(lolwa.mp3)。

PPS- Giving the absolute path of the mp3 file ( file:///C:/wamp/www/php/lolwa.mp3 in my case ) does not work either! PPS-提供mp3文件的绝对路径(在我的情况下为file:/// C:/wamp/www/php/lolwa.mp3)也不起作用!

You have to give the absolute path for getting mp3 data using id3_get_tag() function. 您必须提供使用id3_get_tag()函数获取mp3数据的绝对路径。

<?php
    $tag = id3_get_tag($_SERVER['HTTP_REFERER'].'lolwa.mp3'); 
    print_r($tag);
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM