Store data without a database?

你。 提交于 2019-12-10 17:54:23

问题


If I would like to store emails, but don't have a database (e.g. MySQL), what should I do?

The data should be accessible and writable from PHP, but regular "visitors" MUST NOT see the data.

Hope you can help.


回答1:


If your data not very large, you can use XML files. But if your data is important and you must secure it , you have to encrypt your data




回答2:


You can put them in files :)

$data; // Defined "somewhere"
file_put_contents('filename.txt', $data);

However, I suggest you to use a database anyway. At least SQLite is installed nearly everywere.




回答3:


You can use the php function mail($to, $subject, $body) to send the email address to your personal email. The data will not be readable from your script, but for your use case this might be ok.




回答4:


Look, while I really don't suggest this, in a pinch you can always output it to a .php file with the first line being exit().

So be sure, you can always */ $mail */ to the file, but this is a poor substitute for the security of having a database to store the information.




回答5:


You could do what Outlook does: create your own file format for the mail and dump mails inside. And implement your own reader.(Its re-inventing the wheel sometimes). But its going to award you with a tonne of control over your mails, allowing for easy back up when needed.



来源:https://stackoverflow.com/questions/6095520/store-data-without-a-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!