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

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

PHP中文网
PHP中文网Original
2016-05-25 17:12:49979browse

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."秒";
?>

                   

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

Statement:
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
Previous article:cookie加密~Next article:mb_substr和mb_strcut的区别