简体   繁体   English

是否有一种保存和显示Web文档编辑的好方法

[英]is there a good way to save and show web document edits

So I'm building a website in php codeigniter, and I have user submitted articles... and I want to have an editing system, kind of like SVN where you can see the changes that have been made, and you can revert to older changes if necessary.. so my question is how do you do that? 所以我正在用php codeigniter构建一个网站,我有用户提交的文章...我想要一个编辑系统,有点像SVN,你可以看到已经做出的更改,你可以恢复到更旧必要时改变..所以我的问题是你是怎么做到的? is there a library that helps with that.. or are there any articles that you guys can recommend on the subject. 有没有一个图书馆帮助...或者有任何文章,你们可以推荐这个主题。 I was thinking of just making a db table where it has an edit id and a date, and the changes made, then compare it to the original doc.. but I don't think that is a very officiant method. 我正在考虑创建一个db表,其中有一个编辑ID和一个日期,并进行了更改,然后将其与原始文档进行比较..但我不认为这是一个非常有用的方法。 so any suggestions would be greatly appreciated. 所以任何建议将不胜感激。

You actually already have an answer to this: use git or svn . 你实际上已经有了这个答案:使用gitsvn If you trust your users to make edits and such, you simply have to script something that will submit their changes to the repository. 如果您信任您的用户进行编辑等,您只需编写将其更改提交到存储库的脚本。 You can then use diff to compare two versions. 然后,您可以使用diff来比较两个版本。 This can also be nice if you want your users to be able to rollback changes and do other things version control libraries do. 如果您希望用户能够回滚更改并执行版本控制库执行的其他操作,这也可能很好。

If showing the diff syntax is insufficient, you can try to parse it into something prettier or use another method. 如果显示diff语法不足,您可以尝试将其解析为更漂亮或使用其他方法。 I'm sure they exist. 我相信他们存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM