处理服务器端用户文件的最佳方法?
我正在尝试制作一个网络应用程序。我为自己制作的应用程序是为了帮助我大学的课程进行外语翻译,我希望将其发布到网上。该网站保存的所有数据的格式如下:
section 1
foreign text
translated text
section 2
foreign text
translated text
该应用程序依赖于 javascript 和 jquery,因此我认为 JSON 将是一种很好的数据格式。我已经建立了一个基本的用户系统,我只需要知道处理项目的最佳方式。看起来最简单的方法是在我的网站上有一个目录,其中每个用户都有一个文件夹。每个用户的文件夹都会有一个针对他们所做的每个项目的单独文件。在加载对话框中,php 将打印用户目录中的文件列表,以便生成已保存项目的列表。
我不认为这是最好的解决方案;我一边做一边把它拼凑在一起。为每个用户提供一个巨大的 json 文件会更好,还是编码会很痛苦?
I'm trying to make a webapp. The application I am making for myself to help with foreign language translations for classes at my college, and I am hoping to make it available online. All the data that the site saves is in a format like:
section 1
foreign text
translated text
section 2
foreign text
translated text
The app relies on javascript and jquery, so I thought JSON would be a good format for the data. I've got a basic user system set up, I just need to know the best way to handle the projects. What seems easiest is to just have a directory on my site in which there is a folder for every user. Every user's folder would have an individual file for each project they've made. In the load dialog the php will print the list of files in the user's directory so as to make a list of saved projects.
I don't believe this is the best solution; I'm kind of hacking this together as I go along. Would one giant json file for each user be better, or just a pain to code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会将所有内容放入数据库而不是单个文件中。
有什么原因不能使用数据库吗?
示例:
简单基本设置将包含 2 个表:
用户:
文本:
foreign_text
和translated_text
的类型为text
。I would put everything in a database and not in individual files.
Is there a reason you can´t use a database?
Example:
The simple basic setup with a database would be something with 2 tables:
Users:
Texts:
Where the
foreign_text
andtranslated_text
are of typetext
.