$text="字符串直接下载";
$fileName="xxx.txt";
header("Content-Type: application/txt");
header("Content-Disposition: attachment; filename=".$fileName);
echo $text;
The above introduces the direct download of php echo string, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.