下载 https://github.com/JamesHeinrich/getID3 ; getid3 包
引入 getid3.php
<?php
require("./../extend/getid3/getid3.php");
$remotefilename = 'http://www.example.com/filename.mp3';
if ($fp_remote = fopen($remotefilename, 'rb')) {
$localtempfilename = tempnam('/tmp', 'getID3');
if ($fp_local = fopen($localtempfilename, 'wb')) {
while ($buffer = fread($fp_remote, 8192)) {
fwrite($fp_local, $buffer);
}
fclose($fp_local);
$getID3 = new \getID3();
$ThisFileInfo = $getID3->analyze($localtempfilename);
unlink($localtempfilename);
}
fclose($fp_remote);
}
$ThisFileInfo['playtime_string']
|