• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php 下载代码,在苹果下不好用!解决方法

php 搞代码 4年前 (2022-01-24) 33次浏览 已收录 0个评论

php 下载代码,在苹果下不好用!

PHP code

<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$file   =   fopen($filename, "r ");Header( "Content-type:   application/octet-stream ");Header( "Accept-Ranges:   bytes ");Header( "Accept-Length:".filesize($filename));Header( "Content-Disposition:attachment;filename= ".$filename);echo   fread($file,filesi<i style="color:transparent">本¥文来源gaodai$ma#com搞$代*码*网(</i><strong>搞代gaodaima码</strong>ze($filename));fclose($file);

刚开始用的这个,直接就把内容输出到页面上了。后来又找了个函数

PHP code

<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function download_file($archivo, $downloadfilename = null) {         if (file_exists($archivo)) {            $downloadfilename = $downloadfilename !== null ? $downloadfilename : basename($archivo);            header('Content-Description: File Transfer');            header('Content-Type: application/octet-stream');            header('Content-Disposition: attachment; filename=' . $downloadfilename);            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($archivo));                 ob_clean();            flush();            readfile($archivo);            exit;        }         }

效果还是一样,求高手解决!

下面是我和一个人的对话:

苹果的接口直接给资源地址就行了

追问

就是说 直接将链接地址设为文件的地址,对吧! 我试过了,不会弹出下载框,也是直接输出要页面!

回答

我刚问过手机组,苹果的操作系统跟windows不同,没有权限下载东西,即使可以下载东西,苹果也不会分配给你存储空间去存储资源。苹果只会识别应用,并且给应用分配一定的空间存储,若要让苹果下载资源,请走应用渠道。

追问

但是我平时有用苹果的操作系统下载东西啊! 就是在网上点下载的时候会弹出下载提示框的! 但是不确定该网站的服务器用的是什么操作系统。 你的意思是不是,苹果的服务器不提供下载? 那么是不是所有拿苹果当服务器的网站都没有下载的功能?

——解决方案——————–

探讨

PHP code

$file = fopen($filename, “r “);
Header( “Content-type: application/octet-stream “);
Header( “Accept-Ranges: bytes “);
Header( “Accept-Length:”.filesize($filename));
Header( “Content……

——解决方案——————–

探讨

浏览器可以下载 http://www.duote.com/soft/2054.html 这个页面上点击下载可以弹出下载框!

——解决方案——————–
这些参数看看有用没?
http://apps.hi.baidu.com/share/detail/35570157
http://blog.gaodaima.com/starzxf/article/details/6746876
http://iask.sina.com.cn/b/6263205


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php 下载代码,在苹果下不好用!解决方法

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址