首页 > 编程语言 >php导出带加密的excel

php导出带加密的excel

时间:2023-07-19 15:47:05浏览次数:47  
标签:xlsx 加密 excel Content header file path php

最近需要用yii2做一个导出excel带密码设置的功能,找了好多都没有达到目的,后来终于在git找到了一个,不过得php版本7.4以上

https://github.com/nick322/secure-spreadsheet

$objWriter = new Xlsx($objPHPExcel);

        $file_path = $title . '.xlsx';
        $objWriter->save($file_path);//保存到本地

        //设置excel文件打开密码
        $xlsx_encrypt = new Encrypt();
        $xlsx_encrypt->input($file_path)
            ->password($data['password'])
            ->output($file_path);

        header('Content-Type: application/octet-stream');
        header('Content-Transfer-Encoding: Binary');
        header("Content-disposition: attachment; filename=\"" . basename($file_path) . "\"");
        readfile($file_path);

        @unlink($file_path);

 

标签:xlsx,加密,excel,Content,header,file,path,php
From: https://www.cnblogs.com/wutianfei/p/17565761.html

相关文章

  • PHP 优雅的发起 http 请求
    <?phpfunctionsendPostRequest($url,$data){//初始化cURL$curl=curl_init();//设置cURL选项curl_setopt($curl,CURLOPT_URL,$url);curl_setopt($curl,CURLOPT_POST,true);curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($......
  • .net 通过反射导出excel
    ///<summary>///详细报表生成excel列名///</summary>privatestaticstring_detailsCloumns=@"ActualClaimAmount,DeclDate";///<summary>///详细报表生成excel///</summary>///<par......
  • 54.使用VUE3+VITE+TYPESCRIPT+element-plus的setup语法糖,实现导出excel功能
    要实现导出Excel功能,你可以使用以下步骤:1.安装相关依赖:```bashnpminstallxlsxfile-saver```2.在你的组件中引入相关依赖:```javascriptimport{ref}from'vue';import{saveAs}from'file-saver';import{useTable}from'element-plus';importXLSX......
  • python将excel内两列的日期合并
    原excel: 目标将year和month合并:year、month里放的1961等是数字,合并日期的时候需要把它们变成字符串再合并,采用.astype(str)#!usr/bin/envpython#-*-coding:utf-8-*-"""@author:Su@file:ceshi.py@time:2023/06/26@desc:"""importpandasaspd#打开excel......
  • bWAPP靶场搭建(phpstudy)
    我目前只打算在windows上使用该靶场,所以只看了windows中phpstudy搭建的教程,如果使用linux的docker,那更方便,phpstudy搭建bWAPP靶场的具体过程可以参考以下两位大佬:无mysql冲突的情况:https://www.cnblogs.com/zzjdbk/p/12981726.html有mysql冲突的情况:https://blog.csdn.net/we......
  • Excel数据分析教程_编程入门自学教程_菜鸟教程-免费教程分享
    教程简介Excel数据分析入门教程-从基本到高级概念的简单步骤了解Excel数据分析,其中包括概述,流程,Excel数据分析概述,使用范围名称,表格,使用文本功能清理数据,清洁数据包含日期值,使用时间值,条件格式,排序,过滤,带范围的小计,快速分析,查找功能,数据透视表,数据可视化,验证,财务分析,使用多个表......
  • 谓词加密(Predicate Encryption, PE)-学习笔记
    该文对谓词加密描述的较为详细,可供参考。出处:廖定锋,王常吉.谓词加密理论与应用研究[D].中山大学硕士学位论文,2010:24-25. ......
  • CSharp: Excel Convert Pdf
     /***netcore6***/usingIronPdf;usingOfficeOpenXml;usingSystem.Text;usingSpire.Pdf;usingSpire.Pdf.Graphics;usingSpire.Xls;usingNPOI.SS.UserModel;usingNPOI.XSSF.UserModel;usingiTextSharp.text;usingiTextSharp.text.pdf;nam......
  • C语言如何实现DES加密与解密
    C语言实现DES加密解密#include"des.h"//移位表staticTable_sizeconstshiftTable[NumberOfKeys]={1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1};//E扩展表staticTable_sizeconsteTable[des_key_pc2_standard]={ 32,1,2,3,4,5,4,5,6,7,......
  • 随机化 base64 加密
    随机化base64加密项目原址:Jeefy/jtim-enc·GitLab技术采用双重随机化技术。第一重随机化是利用固定的随机种子改变base64解码的映射数组。第二重随机化利用单位掩码改变改变固定的随即种子。好像也就没有了……......