duanlinghe8417 2015-06-01 17:07
浏览 16
已采纳

重新加载网页某些时间甚至没有人使用它

I want create a website certain time of the day(e.g. 9pm) will auto reload the webpage .
The main point to reload the webpage is to insert some data into database at certain time even no one viewing at the webpage.

My Idea: Database A : Everytime reach 12am , they will update all the data to 0.
Database B : Want to insert data from database A to track the old data:

INSERT INTO `report`(`updated_date`, `name`, `occupied`) VALUES ('$time','S','$arrayS[$i]')

Due to Database_A 12am will always auto update all the data to 0 , so I need to store the data to Database B. So the User will be able to view the old data.

Current Date is base on Database A and Previous data base on DatabaseB:

(image example :) http://gyazo.com/54e93de27690291a80a3be0d07868b66

I have research afew method and tried out :

1.This method only work when I was viewing the web.However after I close ,no action will be taken.

    $page = $_SERVER['PHP_SELF'];

$now = time();
$today = strtotime('12:12');
$tomorrow = strtotime('tomorrow 12:12');
if (($today - $now) > 0) {
    $refreshTime = $today - $now;
} else {
    $refreshTime = $tomorrow - $now;
}

header("Refresh: $refreshTime; url=$page"); 
  • 写回答

1条回答 默认 最新

  • dpbvpgvrhwxen3222 2015-06-01 17:11
    关注

    You can use a cron if on a linux based environment or Windows Scheduler if you're on a Windows based environment.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示