Detailed explanation of how to obtain audio file duration in PHP

*文
Release: 2023-03-19 06:42:01
Original
4576 people have browsed it

How to get the audio file duration in PHP? This article mainly introduces the method of obtaining the duration of audio files through PHP programming. The function of operating audio files is realized by introducing the third-party getid3 class. Friends in need can refer to it. I hope to be helpful.

The example in this article describes the method of obtaining the duration of audio files through PHP programming. Share it with everyone for your reference, the details are as follows:

Question:

When the forum function was added yesterday, the mobile terminal needs to know how long the audio file is. Audio;

The specific solution is as follows:

The first is to add a field for saving audio files in the database;

Then I found getID3 on the Internet This class can get the duration of the audio file and introduce it into the project;

Secondly, call this class in the interface for uploading audio files on the mobile terminal. The specific writing method is as follows:

$getID3 = new getID3();  //实例化类
$ThisFileInfo = $getID3->analyze($path); //分析文件,$path为音频文件的地址
$fileduration=$ThisFileInfo['playtime_seconds']; //这个获得的便是音频文件的时长
Copy after login

And store the corresponding data in the database;

Then when the mobile terminal needs the data list, just return the audio duration at the same time

Related recommendations:

Detailed explanation of how to enable PHP to implement breakpoint resume transmission

php method to obtain flash detailed data

How PHP implements image recognition

The above is the detailed content of Detailed explanation of how to obtain audio file duration in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!