【发布时间】:2020-10-15 10:38:11
【问题描述】:
<?php
$name = 't1__'.date('m-d-Y_hia__').$_GET["ident"].'.txt';
$myfile = fopen($name, "w") or die("Unable to open file!");
fwrite($myfile, $_GET["value"]);
fclose($myfile);
?>
嗨!我需要帮助!
所以.. 我有一个文件 axWrite.php,它将从我创建的基于 Web 的研究中获取值,但我想添加一个下载按钮,以便在打开每个文件时获取包含内容的 csv 文件。
例如,从这张图片中:Picture of the files created from axWrite.php我希望能够在单击链接或输入文件时下载,我可以在页面Inside the page with the get values内有一个按钮下载到csv文件/p>
我试过了:
$filename = $name.".csv";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: text/csv; charset=UTF-16LE");
$out = fopen("php://output",'w');
但它没有做任何事情,因为它只在我点击 axWrite.php 时创建一个空白页面。
任何帮助都会有所帮助!
谢谢,
【问题讨论】: