Home > php教程 > PHP源码 > PHP获取音乐文件播放总时间

PHP获取音乐文件播放总时间

PHP中文网
Release: 2016-05-25 17:12:49
Original
985 people have browsed it

PHP获取音乐文件播放总时间

/*
* @Author : 冷流云
*
**/
<?php
// mp3, wav 或者其他 media player 支持的格式.
$file = realpath("1.mp3"); 
$player= new COM("WMPlayer.OCX");
$media = $player->newMedia($file);
$time=$media->duration;   // “单位/秒”
$h=floor($time/3600);
$m=floor(($time %3600)/60);
$s=floor($time-$h*3600-$m*60);
echo $h."小时".$m."分".$s."秒";
?>
Copy after login

                   

 以上就是PHP获取音乐文件播放总时间的内容,更多相关内容请关注PHP中文网(www.php.cn)!

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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template