有没有编程方法可以在php网站中实现版本控制

发布于 2024-11-05 04:11:35 字数 237 浏览 0 评论 0原文

我有用 php 构建的网站。

我喜欢在如此编辑的答案中使用的修订控制系统。就像我们可以看到所有旧的修订版一样。

现在我对此很陌生,不知道如何实现它。我的意思是它是一个软件插件或其编程方式。

如果我想对我的所有 php 文件执行此操作,该怎么做。

我知道有这样的软件,但是如何将这些软件与像SO这样的网站链接起来。我的意思是虽然在软件中可能有所有旧版本,但如何将它们与 webiste php 链接

I have website build in php .

I like the revision control system used in SO edited answers. like we can see al the old revisions.

Now i am new to that and have no idea how to implement it . i mean its a software plugin or its programmed like that.

If i want to do that on my all php files how to do that.

I know there are software for that but how link those with website like SO has done . i mean although in the software there may be all the old versions but how to link those with webiste php

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一腔孤↑勇 2024-11-12 04:11:35

它需要对数据库进行更多工作。您的应用程序必须自行存储旧版本(或使用触发器/视图)。通常,会为您通常存储在数据库中的所有内容创建一个单独的存档表。其中的关键部分是版本字段:

CREATE TABLE articles (     // always the current version
     title VARCHAR,
     content TEXT
)
CREATE TABLE articles_ARCHIVE (
     version INT with AUTO_INCREMENT,
     title VARCHAR,
     content TEXT,
)    // yes, that's not a correct CREATE TABLE, just figuratively

每当您定期更新文章表时,您都会首先将当前版本存储到 _archive 表中。然后才将新的当前文本存储到常规表中。

现在要复制 SO 提供的内容,您还需要一些更多的 UI 逻辑。但是将 _archive 文本与当前版本进行比较的差异视图并不困难(请参阅 PEAR Text_Diff)。

我认为您可以查看常见的 Wiki 实现来了解它在实践中是如何完成的。

It requires more work with the database. Your application will have to store old revisions itself (or use triggers/views). Commonly a separate archive table is created for everything you normally store in your database. The crucial part of that is a version field:

CREATE TABLE articles (     // always the current version
     title VARCHAR,
     content TEXT
)
CREATE TABLE articles_ARCHIVE (
     version INT with AUTO_INCREMENT,
     title VARCHAR,
     content TEXT,
)    // yes, that's not a correct CREATE TABLE, just figuratively

And whenever you regularily would just update the articles table, you will instead first store the current version into the _archive table. And only afterwards store the new current text into the regular table.

Now to replicate what SO provides, you will also need some more UI logic. But a diff view for comparing _archive texts against the current version is not difficult (see PEAR Text_Diff).

I think you could look into a common Wiki implementation to get an idea how it is done in practice.

戈亓 2024-11-12 04:11:35

使用 GIT 进行代码控制,并查看这些 现有 PHP 前端 到 GIT 以帮助您入门。

我猜SO的评论系统是定制的,所以你必须自己构建你想要的东西。

Use GIT for your code control, and have a look at these existing PHP frontends to GIT to get you started.

SO's review system is custom-built I guess, so you'll have to build what you want on your own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文