先引入資源。然後需要用到的插入以下代碼
//獲取時長
require HTML_PATH . 'system/extend/getID3/getid3/getid3.php';
$mp3 = new \getID3();
$infos = $mp3->analyze(HTML_PATH . $filename[0]);
$playtime_seconds = $infos['playtime_seconds']; //秒數 3
$playtime_string = $infos['playtime_string']; //完整時長 0:03
//echo $playtime_seconds;
//echo $playtime_string;
$return ['param'] = $playtime_string;
//print_r($infos);