我认为您应该考虑重构代码以将帖子存储在数据库中.
从那里,你有一个页面(http://mysite/showpost.php?post_id = 5)显示你的帖子(psuedo-code’ish):
// establish database connection here
// Simple SQL injection prevention:
foreach ($_REQUEST as $key => $value)
{
$_REQUEST[$key] = mysql_real_escape_string($value);
}
// Get the appropriate post from the posts table.
$query = "SELECT post FROM posts WHERE post_id={$_REQUEST['post_id']}";
$result = mysql_query($query);
$row = mysql_fetch_assoc($query);
echo $row['posts'];
// Get the appropriate comments from the comments table.
$query = "SELECT comment FROM comments WHERE post_id={$_REQUEST['post_id']}";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result))
{
echo "Comment: {$row['comment']}";
}
// close connections, etc.
?>
我的PHP非常生疏,但这应该让您对完成所需内容所需的数据结构和代码有所了解.