Home > Backend Development > PHP Problem > How to add music playback in php

How to add music playback in php

Release: 2023-02-27 21:14:01
Original
6161 people have browsed it

How to add music playback in php

PHP plus music playback:

1. Define the mp3 file path under a disk, such as under d:/music

2. Read Get the file size

3. Set the media type of the file header

4. Read the file

Implementation code:

<?php

="d://music/";
$filesize=filesize($path.$file_name);

header("Content-type:audio/mpeg");
header("Content-length:$filesize");
readfile($paht.$file_name);
?>
Copy after login

Recommendation:php server

The above is the detailed content of How to add music playback 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