-1

I want to embed audio files into php website. But I found it impossible because there is no such tag or function in php as in html5 where tag audio can be displayed in a website. I hope there is an easy way to achieve it. If there's not, I hope your solution will be as detailed as possible. Thanks!!!

chucklai
  • 814
  • 2
  • 10
  • 26

1 Answers1

1

there is no such tag or function in php as in html5

If the output of your PHP file has a HTML5 doctype (and the content type text/html), it will be interpreted as HTML5.

There are several ways to output HTML code in a PHP file:

  1. echo
    <?php
        echo '<p>This is a <b>paragraph</b>.</p>';
    ?>
  1. plain output
    <p>This is a <b>paragraph</b>.</p>
  1. conditional output
    <?php if ($condition) { ?>

    <p>This is only printed if the condition is true.</p>

    <?php } ?>

Besides echo there are some more functions to output text: var_dump and printf, for example.

Aloso
  • 5,123
  • 4
  • 24
  • 41
  • hi aloso, i changed my mind, i'm now using html5 to capture an audio file now. here's my code in java script. var context = new (window.AudioContext || window.webkitAudioContext)(); var mediaStreamSource = context.createMediaStreamSource(s); recorder = new Recorder(mediaStreamSource); recorder.record(); an error happened here which shows that recorder is not defined here. do i miss any headfile here?please help me out. – chucklai Mar 28 '17 at 08:14