Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use getID3 to obtain Audio in PHP

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

PHP how to use getID3 to obtain audio, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Use

Because this is not a standard package that conforms to the PSR-4 specification (there is no namespace, and the class name is not very detailed), just add the entire folder if you want to use it in the project, and then introduce getid3/getid3.php. If it is in Laravel, it can be introduced in this way.

Extract the file, put the folder under the project, I put it under vendor (there are a lot of useless files in the package that can be deleted)

Edit the composer.json file

Find autoload to append the introduction to the classmap array below it

"vendor/getID3/getid3/getid3.php", "vendor/getID3/getid3/getid3.lib.php"

Then execute composer dump-autoload

Finally, you can introduce it where you need it.

Here is a demo

$path = storage_path ('uploads/60EB4401-33A3-27AEMurF03EMurB54E7282CB5F.mp4'); $mediaTool = new\ getID3 (); $mediaInfo = $mediaTool- > analyze ($path); dd ($mediaInfo)

There will be a lot of attributes, depending on your needs to get it. For example, playtime_seconds is the duration of the media. The great task has been completed!

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report