PHP实现远程图片下载
/** * 文件下载 * @param string $url */ public function download() { $url = $this->input->get_post('url'); $fileName = time() . substr($url, strrpos($url, '.')); $fileInfo = get_headers($url); header('Content-Type: appliaction-octet-stream'); //文件流 header($fileInfo[4]); //文件大小 header('Content-disposition: attachment; filename=' . $fileName);//文件名称 readfile($url); }