How to convert base64 string into an audio mp3 file?

安稳与你 提交于 2021-02-14 18:36:12

问题


I'm getting a base64 string from android side. I have to convert it into an audio file and have to save it into a folder. I thought I have to convert it first into byte array. Then after it, I have to convert it into a mp3 file. But don't know how. I have done work in base64 to image. If anyone know answer then please explain with an example. Thank You.


回答1:


If the base64 encoded data already represents an MP3 file, it should be as easy as decoding the base64 data and storing it in a file:

file_put_contents('audio.mp3', base64_decode($data));


来源:https://stackoverflow.com/questions/30572374/how-to-convert-base64-string-into-an-audio-mp3-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!