我想自定义我的自动下载功能,只是重定向到下载页面是unautomatic

时间:2015-08-11 08:36:07

标签: php function

我想自定义我的功能,目前,当我点击下载它自动下载mp3文件,但我希望它只是重定向到下载页面,让用户点击自己下载,所以我不希望它是自动下载,我应该如何更正我的代码请帮助这是我的代码谢谢 总之,我想关闭强制下载,这是我的网站你可以试试,www.vox79.com 这是我的下载帮助代码链接(http://www.vox79.com/page/35-code

function download_mp3()
{
    $query              = decode(urlencode($this->input->get("q",TRUE)));   
    $data               = json_decode(searchYoutube($query));       
    $artist             = urldecode($this->input->get("a",TRUE));       
    $track              = urldecode($this->input->get("t",TRUE));   
    setDownload($artist,$track,'','mp3');           

    $videoID            = get_video_id($data);

    $video              = "https://www.youtube.com/watch?v=".$videoID;
    $download_service   = $this->config->item("download_service");              
    $download_service   = str_ireplace("%youtube_url%", $video, $download_service);
    $download_service   = str_ireplace("%youtube_video%", $videoID, $download_service);             
    if($videoID == '')
    {
        redirect("http://www.youtube.com/results?search_query=$query",'location');
    }
    else
    {
        redirect($download_service,'location');
    }
}

1 个答案:

答案 0 :(得分:1)

 if($videoID == '')
    {
        header('Location: http://www.youtube.com/results?search_query=$query');
    }