若你要部署文件分发服务,直接远程访问文件可能会无法下载,会返回资源不存在
可以用PHP脚本解决,PHP版本5.2(可在云虚拟主机控制台管理页面底部更改PHP版本)
这里提供一个简单的脚本示例:
<?php
$file = '需要下载的文件'; // 资源文件
$filepath = './' . $file;// 文件路径
if (file_exists($filepath)) {
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.android.package-archive');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filepath));
readfile($filepath);
exit;
} else {
http_response_code(404);
echo "文件没找到";
}
?>
*下载量少可以,若是你用户较多,下载量大,可能会被官方封禁~
下面是官方的规则:
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/9106.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~