日期:2014-05-17  浏览次数:20380 次

thinkphp 下载 基于Http
PHP code

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/{$vo.Download}">下载</a></td>
不能下载 求解释



------解决方案--------------------
<a href="oa/Tpl/Public/Upload/{$vo.Download}">下载</a></td>


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

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