【问题标题】:In php how to use jwplayer to hide the actual path在php中如何使用jwplayer隐藏实际路径
【发布时间】:2012-08-01 14:23:29
【问题描述】:

我在 html 中创建了一个上传文件和一个 php 文件,用于将音频文件名插入表中,上传到服务器中的特定文件夹。如果我使用这样的简单 php 编码,一切正常:

<?
require 'dbconnect.php';
$audio=basename($_FILES['file']['name']);
$audio=str_replace(' ','|',$audio);
//$date=date('YmdHis');


$audio=$audio.".mp3";
$tmppath1="audios/".$audio;
move_uploaded_file($_FILES['file']['tmp_name'],$tmppath1);
$query="INSERT INTO `tbl_audio` (`audioname`, `guid`) VALUES ('$audio', '$guid');";
$res=mysql_query($query);
if($res)
{
$message=array("message"=>"uploaded");
$query1="select * from tbl_audio order by date desc";
$res1=mysql_query($query1);
$row1=mysql_fetch_row($res1);
if($row1[1])
{
$audiopath="http://test.com/audios/".$row1[1];
/* get the short url */
$short_url = get_bitly_short_url($audiopath,'XXXXXXXXX','XXXXXXXXXXXX');
}
else
{
$audiopath="";
}
$message=array("audioid"=>$row1[0],"audiopath"=>$short_url,"key"=>"uploaded","guid"=>$row1[3],"audioname"=>$row1[1]);
}
else
{
$message=array("message"=>"failed to upload");
}
}
echo json_encode($message);

但我的上级告诉不要直接显示音频文件的实际路径和名称,而是使用 jwplayer 隐藏它。 代码如下:

<script type='text/javascript' src='jwplayer/jwplayer.js'></script>

<div id='mediaplayer'></div>

<script type="text/javascript">
  jwplayer('mediaplayer').setup({
    'id': 'playerID',
    'width': '480',
    'height': '270',
    'file': 'http://test.com/test/audios/Testaudio.mp3',
    'modes': [
        {type: 'html5'},
        {type: 'flash', src: 'http://test.com/jwplayer/player.swf'},
        {type: 'download'}
    ]
  });

我可以在浏览器中播放音频。但是如何更改生成的 url 并将其作为对开发人员的响应? 我想要的是获取音频文件的 url 路径,而不是像player.php?id=abc 这样的名称 我使用 bitly api 来减少路径 请帮忙, 谢谢...

【问题讨论】:

    标签: php web-services jwplayer


    【解决方案1】:

    我猜你需要修改标题。

    在 player.php 中,您执行逻辑来查找您不想贡献的文件的物理路径。

    那么你必须更改标题

    这是第一个答案中的示例

    Setting up apache to serve PHP when an MP3 file is requested

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-24
      • 2011-06-22
      • 2020-02-28
      • 1970-01-01
      • 2017-02-03
      • 1970-01-01
      • 1970-01-01
      • 2017-06-06
      相关资源
      最近更新 更多