Home  >  Article  >  Backend Development  >  How to add music playback in php

How to add music playback in php

尚
Original
2019-10-28 14:39:086116browse

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);
?>

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!

Statement:
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