簡體   English   中英

如何在php中播放音頻剪輯?

[英]How can i play an audio clip in php?

我想要的是在執行此腳本的同時播放音頻剪輯

<?php
 session_start();
 unset($_SESSION["username"]);

echo "<script>

 alert('You have Logout successfully and see you next time.');
 window.location='AdminLogin.php';

</script>";
?>

使用此代碼:

 var audio = new Audio('path_to_your_audio_file.mp3');
 audio.play();

該路徑應指向您的服務器或另一台服務器。

完整代碼:

<?php
 session_start();
 unset($_SESSION["username"]);

echo "<script>

 var audio = new Audio('path_to_your_audio_file.mp3');
 audio.play();
 alert('You have Logout successfully and see you next time.');
 window.location='AdminLogin.php';

</script>";
?>

例:

 var audio = new Audio("http://soundbible.com/mp3/sawing-wood-daniel_simon.mp3"); audio.play(); 

這是使用javascript的極簡解決方案。

<script>
    new Audio('path_to_your_audioclip').play();
</script>

只需將path_to_your_audioclip更改為剪輯位置,即可將這段代碼放在<?php ?>之外的任何位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM