gpt4 book ai didi

PHP 无法在我的服务器上正确下载 apk 文件

转载 作者:行者123 更新时间:2023-12-05 08:58:36 26 4
gpt4 key购买 nike

我必须从我的服务器下载一个 apk 文件,但我的下载不完整。

这是代码:

header('Content-Type: application/vnd.android.package-archive');
header('Content-Disposition: attachment; filename="Zappapp1.0.apk"');
readfile('Zappapp1.0.apk');

编辑

我试过了但是没用..

$file = 'zappapp.altervista.org/apk/Zappapp1.0.apk';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.android.package-archive');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}

抱歉我的英语不好,但我是意大利人..

最佳答案

你可以试试这个也许对你有帮助................................

$file = '/home/bla-bla/domains/bla-bla.com/file/file.apk'; //not public folder
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.android.package-archive');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}

关于PHP 无法在我的服务器上正确下载 apk 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22267692/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com