dook0034 2014-07-03 01:38
浏览 70

file_get_contents或文件函数挂起

I have developed an application for dental offices which sends automatic email and sms reminders at preset time of the day. This will be a local php application installed on client's machine since the database is local. I want to make it a monthly subscription service. In order to implement the subscription logic, my idea is to keep a text file on my server which will have an expiration date. The local application will read the contents of the text file to make sure that the subscription is not expired.

Now the problem is, when I use file() or file_get_contents() function in my script to read the text file on my server (for example, www.abcde.com/expiration.txt), it keeps forever to read the text file. Now if I directly put the url of the text file in seperate browser window, it opens it right away. Once I do that, the php script works fine. Again after a while, same cycle starts.

  • Am I missing something here?
  • Is there a better way to achieve the subscription logic?

My php application is 'local' using wamp server.

  • 写回答

2条回答 默认 最新

  • dongyong8071 2014-07-03 02:18
    关注

    If i understand what you say, you want to create a subscription system for those messages right ?

    You can use a new table in your DB with 3 cols : id, client_id, sub_time

    It look pretty easy to check if the client is still subscriber of the messages like this i think. You just have to compare sub_time and current time, and see if ( $sub_time + 3600*24* $nb_of_day_in_last_month ) >= $current_time, or something like that ... :D

    评论

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路