我有这个代码:
<html>
<head>
<title>Chipperyman573</title>
<link rel="shortcut icon" href="/fav.ico" />
</head>
<body>
<form method="post" action="change.php">
Top: <input type="text" name="top" /><br>
Bottom: <input type="text" name="bottom" /><br>
Time (MS): <input type="text" name="time" /><br>
<input type="submit" value="Save" name="submit" />
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])){
$fi = "/var/www/rtf/webR/top.txt";
file_put_contents($fi, $cont);
$cont = $_POST["top"];
}
?>
当我转到更改页面 (chipperyman573.com/rtf/webR/change.php) 并填写表格,然后单击提交时,文本文件会自行清除。为什么?
我想清除文本文件的当前内容并将它们替换为我输入的内容。