Home > php教程 > php手册 > php获取音乐文件播放时间

php获取音乐文件播放时间

WBOY
Release: 2016-06-13 10:00:42
Original
1432 people have browsed it

文章简单的介绍了关于php音乐文件播放时间代码,有需要的朋友可以仔细的看看哦。 // mp3, wav 或者其他 media player 支持的格式.

 代码如下 复制代码
$file = "C:/Users/Public/Music/Sample Music/Kalimba.mp3";
 
if (!file_exists($file)) {
    exit('媒体文件不存在.');
}
 
// 创建一个Windows Media Player接口
$player = new COM("WMPlayer.OCX");
$media  = $player->newMedia($file);
 
// 获取歌曲时间 (单位秒)
echo $media->duration.'秒';
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template