设计网站时,我可以选择哪些数据存储选项?
我是一名网站设计师,我设计网络网站和应用程序。我使用 PHP。
我经常发现我必须存储信息,这些信息需要用户在浏览器关闭后访问。
到目前为止,我一直使用数据库(准确地说是 MySQL)来存储信息,但是有时,我觉得我存储的信息不需要数据库存储,主要是因为数据库不随应用程序一起移动 - 它需要单独创建。
还有其他选项可以存储少量数据吗?也许更简单的东西?
I am a website designer, and I design both sites and applications for the web. I use PHP.
I often find I have to store information, which needs to be accessed by the user after the browser is closed.
Up until now I have always used a database (MySQL to be precise) to store information, however sometimes, I feel that I am storing information that does not warrant database storage, mainly because the database does not travel with the application - it needs to be created separately.
Are there any other options for storing small amounts of data? Something simpler perhaps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用应用程序部署属性文件或 XML 文件来存储您认为不适合数据库的内容。
You could deploy a properties file or an XML file with the app to store things you don't feel are appropriate to a database.
http://www.sqlite.org/
它仍然是一个数据库,只是在一个文件中。不需要(太多)设置。
http://www.sqlite.org/
It's still a database, just within a file. No(t much) setup required.
如果你能区分用户,数据库就完全没问题。其他存储机制包括 Cookie 和 Google Gears 以及 XML 或纯文本文件等仿数据库。
Database is perfectly fine if you can differentiate users. Other storage mechanisms include cookies and Google Gears and ersatzdatabases like XML or plain-text files.
我知道您使用的是 PHP,但也有一些其他语言的 Web 应用程序框架,例如 Happstack (适用于 Haskell )使用基于内部 RAM 的磁盘上序列化的数据存储。
如果你有兴趣,你可以研究一下这个方法,我敢打赌还有其他方法。
I know that you are using PHP, but some Web application frameworks for other languages such as Happstack (for Haskell) use an internal RAM based data storage serialized on the disk.
If you are interested, you can study the approach, I bet there are others.