获取创建评论的时间范围,例如“ 2分钟前创建评论”
评论创建的时间范围应该更新。
这是我的代码
<?php
if($_POST){
$created_date = date("Y-m-d H:i:s");
$name = $_POST['name'];
$comment = $_POST['comment'];
$handle = fopen("comments.php", "a");
fwrite($handle, "<b><i>" . $name . "</b></i> said: " . " on ". $created_date . "<br />" . $comment . "<br />");
fclose($handle);
}?>
<form action="" method="POST">
Name : <br /><input type="text" name="name" /> <br />
Comment : <br /><textarea rows="10" cols="30" name="comment"></textarea><br /><br />
<input type="submit" value="Post Comment" />
</form>
<hr />
<h1>Other Comments</h1>
<?php
include "comments.php";
?>