gpt4 book ai didi

javascript - 如何在php中播放音频剪辑?

转载 作者:行者123 更新时间:2023-12-03 01:41:24 25 4
gpt4 key购买 nike

我想要的是在执行此脚本的同时播放音频剪辑

<?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 - 如何在php中播放音频剪辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47122534/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com