PHP:我需要一个类似数据库的解决方案,将数据存储在本地文件系统中

发布于 2024-10-08 06:17:18 字数 401 浏览 3 评论 0原文

这是一个相当长的故事,但简而言之,我需要将数据库的一部分存储在本地文件系统中。我不能使用像 MySQL 这样的普通数据库,也不能使用 XML 文件(理论上我可以使用 XML-s,但它们不够灵活,我需要一些非常复杂的 PHP 代码层来使 XML-s 可用)。是否有某种解决方案允许将多个数据库表移动到文件系统并对其进行正常操作?

几年前我使用过平面文件,它们非常接近我的需要。然而,我不喜欢平面文件的是它们很粗糙 - 你需要手动完成所有操作,你不能只做“从某个表中选择名称,其中年龄> 30”之类的事情,而是需要手动浏览文件并选择所需的条目。

那么,您能否建议一些模仿 SQL 但将所有内容存储在本地文件中的解决方案。此外,这不应该是非常奇特的东西,因为该产品将部署在许多随机主机上,并且通常我们无法控制那里安装的内容。

感谢您的帮助!

It's a rather long story but to make it short I need to store a part of my database locally, in the filesystem. I can't use normal database like MySQL and I can't use XML files (theoretically I can use XML-s but they are not flexible enough, I will need some very complex layer of PHP code to make XML-s usable). Is there some kind of solution which will allow to move several DB tables to filesystem and do normal operations with them?

I worked with flat files years ago and they are very close to what I need. However what I didn't like about flat files is that they are crude - you need to do everything manually, you can't just do something like "SELECT name FROM some_table WHERE age>30", instead you need to manually go through file and select the required entries.

So, could you suggest some solution that imitates SQL but stores everything in a local file. Also this shouldn't be something very exotic because the product will be deployed on many random hostings and usually we don't have control over what is installed there.

Thanks for any help!

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

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

发布评论

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

评论(2

泼猴你往哪里跑 2024-10-15 06:17:18

您需要的是 SQLite:http://www.sqlite.org/ 它在 PHP 中得到了很好的支持:< a href="http://php.net/manual/en/book.sqlite3.php" rel="nofollow">http://php.net/manual/en/book.sqlite3.php

What you need is called SQLite: http://www.sqlite.org/ It's well supported within PHP: http://php.net/manual/en/book.sqlite3.php

∞觅青森が 2024-10-15 06:17:18

Gladius DB 是一个用纯 PHP 编写的快速高效的 PHP 平面文件数据库引擎;它的 SQL 语法与中间 SQL92 的子集兼容。您不需要任何特定的扩展即可使其工作,并且它与 adoDB lite 驱动程序捆绑在一起。

Gladius DB is a fast and efficient PHP flatfile database engine written in pure PHP; its SQL syntax is compatible with a subset of intermediate SQL92. You will not need any specific extension to have it work, and it is bundled with an adoDB lite driver.

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