我有一个使用以下语法链接到歌曲的音乐播放器:
<li><a href="" data-src="http://s3.amazonaws.com/audiojs/02-juicy-r.mp3">title</a></li>
Run Code Online (Sandbox Code Playgroud)
有没有办法让我可以执行服务器端,然后为用户显示(如下所示)?
在搜索时,我碰到了这个...我喜欢有一个外部文件背后有这个数据的想法...像:
<?php
// get-file.php
// call with: http://yoururl.com/path/get-file.php?id=1
$id = (isset($_GET["id"])) ? strval($_GET["id"]) : "1";
// lookup
$url[1] = 'link.mp3';
$url[2] = 'link2.mp3';
header("Location: $url[$id]");
exit;
?>
Run Code Online (Sandbox Code Playgroud)
然后使用:http://yoururl.com/path/get-file.php?id = 1作为链接...唯一的问题是当你输入http://yoururl.com/path/get-file时. php?id = 1用户直接进入文件...是否有任何方法可以禁用该功能......也许是get-file.php本身的一些代码?
我具有以下两个功能相同的功能,可以将这两个功能组合为一个功能吗?
$(document).ready(function(){
$("#nav li").click(function(e) {
e.preventDefault();
$("#nav li").removeClass("current_page_item");
$(this).closest("li").addClass("current_page_item");
});
$("#overlay li").click(function(e) {
e.preventDefault();
$("#overlay li").removeClass("current_page_item");
$(this).closest("li").addClass("current_page_item");
});
});
Run Code Online (Sandbox Code Playgroud)
谢谢,
乔希