假设我的PHP代码如下:
<?php
// Get form variables using POST method
$MarriagePostMortem=stripslashes($_POST['MarriagePostMortem']);
$AutoSavesToKeep=stripslashes($_POST['AutoSavesToKeep']);
// Open and write file
$myFile="S3S.cfg";
$fh = fopen($myFile, 'w+') or die("can't open file");
fwrite($fh, "The Sims 3 Starter Configuration
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
MarriagePostMortem $MarriagePostMortem
AutoSavesToKeep $AutoSavesToKeep
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-");
fclose($fh);
//echo "file written\n";
?>
我希望直接将文件发送给用户进行下载,而不需要将其保存到服务器上。由于我的PHP技术不是很好,所以我需要添加/更改哪些内容才能实现这一点呢?