【发布时间】:2014-05-18 20:24:22
【问题描述】:
当我运行这个 PHP 代码时,它应该存储注释,但它并没有像它应该做的那样在 cmets.txt 中写入任何内容。请找出错误。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Welcome</title>
</head>
<body>
<?php
setcookie("username","admin", time()+3600);
setcookie("password","xss", time()+3600);
if($_POST['content']!=null){
$fp= fopen('comments.txt','a');
fwrite($fp,$_POST['content'], "</hr>");
fclose($fp);
}
echo nl2br(file_get_contents('comments.txt'));
?>
<h3>Post Your HTML Code here</h3>
<form action="index.php" method="post">
<textarea name="content" rows="3" cols="100"></textarea>
<br/>
<input type="submit" value="Post" />
</form>
</body>
</html>
您可以在我的网站here 上查看此演示。
【问题讨论】:
标签: javascript php jquery html web-services