Home > php教程 > PHP源码 > body text

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

PHP中文网
Release: 2016-05-25 17:08:59
Original
1331 people have browsed it

[代码][PHP]代码 

/*
* @Author : PHP中文网
*
**/
<?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


Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!