第一种:

1 <? ?>

<?php
//下载文件保存到本地
//www.jbxue.com
function downfile($fileurl)
{
ob_start();
$filename=$fileurl;
$date=date("Ymd-H:i:m");
header( "Content-type: application/octet-stream ");
header( "Accept-Ranges: bytes ");
header( "Content-Disposition: attachment; filename= {$date}.doc");
$size=readfile($filename);
header( "Accept-Length: " .$size);
}
$url="url地址";
downfile($url);
?>

第二种:

1 <? downfile( ?>

php 下载保存文件保存到本地的两种方法的更多相关文章

  1. 使用c#检测文件正在被那个进程占用 判断文件是否被占用的两种方法

    C# 判断文件是否被占用的三种方法 using System.IO; using System.Runtime.InteropServices; [DllImport("kernel32.d ...

  2. [C#.Net]判断文件是否被占用的两种方法

    今天开发产线测试Tool时发现日志文件会几率性的被占用,上网浏览找到最简单的代码(API或者FileStream),在这里抛砖引玉下. 第一种方法:API using System.IO; using ...

  3. Maven使用第三方jar文件的两种方法

    转于http://blog.csdn.net/youhaodeyi/article/details/1729116 主要用于回查与标记 在Maven中,使用第三方库一般是通过pom.xml文件中定义的 ...

  4. Maven使用第三方jar文件的两种方法 转

    在Maven中,使用第三方库一般是通过pom.xml文件中定义的dependency从远程repository中下载该库.但是如果库文件是公司内部的库,或者在本地而不能通过远程repository下载 ...

  5. Maven使用第三方jar文件的两种方法<转>

    http://www.cnblogs.com/sekai/p/5932206.html 今天用上了.. ===================== 在Maven中,使用第三方库一般是通过pom.xml ...

  6. 【转】php 下载保存文件保存到本地的两种实现方法

    来源:http://www.jb51.net/article/40485.htm 第一种: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <?php function d ...

  7. php 下载保存文件保存到本地的两种实现方法

    这里的下载,指的是 弹出下载提示框. 第一种: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <?php function downfile() {  $filename ...

  8. 两种方法上传本地文件到github

    https://www.jianshu.com/p/c70ca3a02087 自从使用github以来,一直都是在github网站在线上传文件到仓库中,但是有时因为网络或者电脑的原因上传失败.最重要的 ...

  9. 两种方法上传本地文件到github(转)

    自从使用github以来,一直都是在github网站在线上传文件到仓库中,但是有时因为网络或者电脑的原因上传失败.最重要的原因是我习惯本地编辑,完成以后再一起上传github.看过了几个教程,总结出最 ...

随机推荐

  1. css模仿表格 居中

    <div class="service_box"><div class="service_list"> <span class=& ...

  2. {$ecs_css_path}

    includes里的init.php的187-194行 if (!empty($_CFG['stylename'])) { $smarty->assign('ecs_css_path', 'th ...

  3. Round and Round We Go

    http://acm.hdu.edu.cn/showproblem.php?pid=1313 考查大整数与小整数相乘 #include<iostream> #include<cstd ...

  4. ant 执行到javac时运行中止,怎么办?

    今天下午我用ant,明明都能打出target.后来改了点代码就不行了,执行到compile的javac时运行中止,真是见鬼了. 在ant构建文件上右击,点击"run as"-> ...

  5. dede完美分页样式

    html <div class="dede_pages">              <ul class="pagelist">     ...

  6. extjs form.load()加载服务端数据

    formPanel.getForm().load({ url: 'getApproveRefundInf?refundIdDetail=${refundIdDetail}', waitMsg: '请稍 ...

  7. Virtio:针对 Linux 的 I/O 虚拟化框架

    Virtio:针对 Linux 的 I/O 虚拟化框架 --http://www.ibm.com/developerworks/cn/linux/l-virtio/#ibm-pcon 使用 KVM 和 ...

  8. Spring MVC中使用Interceptor拦截器

    SpringMVC 中的Interceptor 拦截器也是相当重要和相当有用的,它的主要作用是拦截用户的请求并进行相应的处理.比如通过它来进行权限验证,或者是来判断用户是否登陆,或者是像12306 那 ...

  9. 11月09日《奥威Power-BI vs微软Power BI》腾讯课堂开课啦

    上过奥威公开课的同学可能有一个疑问:奥威Power-BI和微软Power BI是同一个吗,为什么叫同样的名字?正如这个世界上有很多个John.Jack.Marry…一样,奥威Power-BI和微软Po ...

  10. gcc选项-g与-rdynamic的异同_转

    转自:http://www.tuicool.com/articles/EvIzUn gcc 的 -g ,应该没有人不知道它是一个调试选项,因此在一般需要进行程序调试的场景下,我们都会加上该选项,并且根 ...