Home  >  Article  >  Backend Development  >  thinkphp 下载 基于Http解决思路

thinkphp 下载 基于Http解决思路

WBOY
WBOYOriginal
2016-06-13 13:32:50893browse

thinkphp 下载 基于Http

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
public static function Download($Download){
    import("Com.Buyback.QueryAmazon"); 
    import("ORG.Net.Http"); 
    $bookInformModel =M("admin"); 
    $result = $bookInformModel->where("Download='$Download'")->select();
    if($result[0]['image'] == ""){
    $data['id'] = $result[0]['id'];
    $remoteUrl = QueryAmazon::getImage($Download); 
    if(!empty($remoteUrl['ImageURL'])){
    $localUrl = "oa/Tpl/Public/Upload/".$Download.".jpg";
    Http::curl_download($remoteUrl['ImageURL'], "./".$localUrl);
    }else{
    $localUrl = "oa/Tpl/Public/Upload/";
    }
    $data['image'] = $localUrl;
    $bookInformModel->save($data);
    return $localUrl;
} 
return $result[0]['image'];
} 

点击下载的时候
<td align="center" colspan="2"><a href="oa/Tpl/Public/Upload/%7B%24vo.Download%7D">下载</a></td>
不能下载 求解释



------解决方案--------------------
下载


oa/Tpl/Public/Upload/{$vo.Download}这个地址对吗。是不是前边应该有点什么,改成绝对链接试试。

确保链接没问题。就找到问题了


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn