Thinkphp downloads Httppublic & nbsp; static & nbsp; function & nbsp; Download ($ Download) {& nbsp; import ("Com. download Buyback thinkphp based on Http
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'];
}
Click to download
Download
Cannot download for explanation
------ Solution --------------------
Download
Oa/Tpl/Public/Upload/{$ vo. Download} is this address correct. Whether the front side should be something or not. change it to an absolute link.
Make sure the link is correct. The problem is found.