小编Kuu*_*huu的帖子

创建文件以供下载而无需使用PHP保存在服务器上

说我的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";
?>
Run Code Online (Sandbox Code Playgroud)

我想将文件直接发送给用户下载而不保存到服务器.我用PHP 真的不是很好,所以我需要添加/更改才能做到这一点?

php file download save

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

download ×1

file ×1

php ×1

save ×1