我用它来将内容放到一个文件中
file_put_contents('abc.txt', $text);
Run Code Online (Sandbox Code Playgroud)
在此之后我需要弹出一个用户保存/下载文件我该怎么做
Ban*_*jer 10
这将为用户提供下载提示:
<?php
header('Content-type: text/plain');
// What file will be named after downloading
header('Content-Disposition: attachment; filename="abc.txt"');
// File to download
readfile('abc.txt');
?>
Run Code Online (Sandbox Code Playgroud)