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."秒";
?>
新聞熱點
疑難解答