zoukankan      html  css  js  c++  java
  • php 下载生成word文件

    方案一
    
    $html2 ='数字'; 
    
    header("Content-type: application/octet-stream"); 
    header("Accept-Ranges: bytes"); 
    header("Accept-Length: ".strlen($html2));
    header('Content-Disposition: attachment; filename=test.doc'); 
    header("Pragma:no-cache"); 
    header("Expires:0"); 
    echo $html2;
    //此方法是放入缓冲区输出, 默认4096. 超出自动就输出到浏览器上了。 可以修改配置文件 output_buffering = 4096 改成 On (无限大)
    
    $html2 = '实验中学'; 
    
    echo $html2;
    
    ob_start();
    header("Content-type: application/octet-stream"); 
    header("Accept-Ranges: bytes"); 
    header("Accept-Length: ".strlen($html2));
    header('Content-Disposition: attachment; filename=test.doc'); 
    header("Pragma:no-cache"); 
    header("Expires:0"); 
    ob_end_clean();
  • 相关阅读:

    入门动态规划问题
    AC自动机
    KMP算法
    [OpenGL]用鼠标拖拽图形移动
    HDU-2222 Keywords Search
    Trie
    Manacher算法
    linux环境搭建
    Android Studio使用JNI和NDK进行开发
  • 原文地址:https://www.cnblogs.com/loveyouyou616/p/4134637.html
Copyright © 2011-2022 走看看