duanlu1876 2015-10-30 12:07
浏览 13

一段时间后从服务器删除一些文本文件[关闭]

I am developing a online store. There is no sign up option. So i used Ajax and PHP to keep users wishlists and carts. For that i create some text file on the server.

Is that okay, or there is better way to do that?

Second question is; if I want to delete those text files after a certain period of time automatically, is it possible?

  • 写回答

1条回答 默认 最新

  • dongshendie8849 2015-10-30 12:15
    关注

    For storing information you might want to lookup MySQL or other type of database.

    For dealing with information expiry date you can do two things:

    1. While storing new information to the database, add a added_on field with current datetime. Upon retrieval, check if that date is older than required period of time and use it accordingly.
    2. Another way is to also store the added_on date and use CRON jobs to check once in a while if that entry is older than required period of time and if it is, delete it.
    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大