获取音频时长
方法1:
这里需要加载getid3的组件包才能运行
include_once app()->getRootPath().'/extend/catcher/getID3-master/getid3/getid3.php';
$getID3 = new \getID3();
$ThisFileInfo = $getID3->analyze(app()->getRootPath().'public/20201215172433.mp3');
$fileduration=$ThisFileInfo['playtime_seconds'];
getID3-master的下载地址:https://download.csdn.net/download/weixin_39720414/85967376
方法2(只支持mp3格式):
$mp3 = new MP3File(app()->getRootPath().'public/20201215172433.mp3');
$a = $mp3->getDurationEstimate();
$billsec = $mp3->getDuration();
文件下载地址:https://download.csdn.net/download/weixin_39720414/85967619