我已经用 fopen 创建了一个文件
$string = '<?php
define ("DB_HOST", "'. $_POST["dbhost"]. '");
define ("DB_USER", "'. $_POST["dbuname"]. '");
define ("DB_PASS","'. $_POST["dbpass"]. '");
define ("DB_NAME","'. $_POST["dbname"]. '")
?>';
$confile = "../lib/con.php";
if (!file_exists($confile)) {
$fp = fopen($confile, "x") or die("can't open file ".$confile);
fwrite($fp, $string);
fclose($fp);
} else {
$fp = fopen($confile, "w") or die("can't open file ".$confile);
fwrite($fp, $string);
fclose($fp);
}
但是现在如果我尝试使用 Dreamweaver 或 Filezilla 下载文件,除非我重命名它,否则它不会下载该文件。谁能弄清楚我在这里做错了什么?