主要是要写好头部信息
$name = 'app-name'; // 下载后,客户端显示的APP 名字
$file = public_path() . "/download/app.apk"; // 下载地址
// 头部信息
$headers = [
'Content-Type' => 'application/vnd.android.package-archive',
'Content-Disposition' => 'attachment; filename="android.apk"',
];
return response()->download($file, $name . '.apk', $headers);
或者直接一个 php 文件
header('Location:http://download.app.com/app.apk');
或者客户直接请求 http://download.app.com/app.apk
链接即可