分类分类
关注+2010-02-04作者:
用PHP如何获取歌曲时间:
PHP代码
<?php
file =realpath("1.mp3"); //当前目录下1.mp3
if (!file_exists(file)) {
exit('文件不存在');
}
player = new COM("WMPlayer.OCX");
media = player->newMedia(file);
time=media->duration;//总的秒数
h=floor(time /3600);//小时
m=floor((time % 3600)/60);//分钟
s=time-h*3600-m*60;//秒数
//m=substr("0".m,-2);//补上0
echo "持续时间:".h."小时 ".m."分 ".s."秒";
?>
相关文章
更多+相同厂商
热门推荐
点击查看更多
点击查看更多
点击查看更多
说两句网友评论