Home > Backend Development > PHP Tutorial > PHP 弹出保存对话框,该如何处理

PHP 弹出保存对话框,该如何处理

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 12:14:02
Original
1145 people have browsed it

PHP 弹出保存对话框
问题是这样的:
需要保存查询出来的表格置为Excel,关于写入内容到Excel都已经完成,
主要是:1、点击导出为Excel时,希望弹出一个保存路径的选择框;
                2、希望是在PHP来控制弹出,而不是前台;
                3、实在是由JS弹出,是不是将文件路径作为参数提交到PHP处理?

由于分数不多,不好意思。
------解决思路----------------------
http://www.cnblogs.com/zcy_soft/archive/2011/06/09/2076728.html
------解决思路----------------------

header("Content-type:application/vnd.ms-excel");<br />header("Content-Disposition:filename=php2excel.xls");<br />echo iconv("UTF-8", "GBK", "姓名") . "\t" . iconv("UTF-8", "GBK", "性别") . "\n";<br />foreach ($get as $key => $value) {<br />echo iconv("UTF-8", "GBK", $value["username"]) . "\t" . iconv("UTF-8", "GBK", $value["sex"]) . "\n";<br />}
Copy after login

------解决思路----------------------
假设如果你能定义了下载保存路径为E盘而用户只有D盘怎么解?所以只能由用户选择存哪里,不过你可以定义保存的文件名,但是不能定义保存路径! 个人理解而已
------解决思路----------------------

引用:
假设如果你能定义了下载保存路径为E盘而用户只有D盘怎么解?所以只能由用户选择存哪里,不过你可以定义保存的文件名,但是不能定义保存路径! 个人理解而已
赞同,要是这样你就还要考虑如果用户不是用windows呢?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template