jQuery的,阿贾克斯或PHP:运行脚本在特定的时间或在后台执行操作 [英] jquery , Ajax or PHP : Run Script at a specific time or perform action in the background

查看:115
本文介绍了jQuery的,阿贾克斯或PHP:运行脚本在特定的时间或在后台执行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找能在特定的时间或在pre定义定期运行的脚本。

I am looking for a script which can run at a specific time or at a pre-defined regular intervals.

这个问题是这样的.....我拉一些外部的内容,以我的网站,我希望它在定期更新。所以我的想法是......

The issue is like this..... I am pulling some external content to my website and I want it to be updated at regular intervals. So what I thought was......

  1. 如果我可以使用某种脚本在我的的index.php 文件,该文件将检查一段时间戳记,如果该时间戳超过一些指定的分钟/小时,然后执行一些指定的操作。

  1. if I could use some sort of script in my index.php file, which will check for some time stamp and if that time stamp is more than some specified minutes / hours, then it performs some specified action.

如果我可以在后台通过Ajax加载此文件,每次有人访问我的网站,并在index.php文件运行。为什么阿贾克斯因为我不希望这影响我的网站的主要页面加载时间。

If I can load this file via Ajax in the background, every time someone visits my site and the index.php file is run. Why Ajax because I don't want this to effect the main-page load time of my site.

我不想使用任何CRON为此因此需要一种替代的解决方案。

I don't want to use any CRON for this hence need an alternative solution.

是否有可能这样做?如果是的话怎么样?

Is it possible to do so? If yes how?

请注意:我的编程知识很新。我刚开始学这么好心要解释这个过程的细节。

Please note : My programming knowledge is very new. I have just started learning it so kindly be explain the process in detail.

推荐答案

下面是一些解决方法:

  1. 使用的jQuery插件定时器其中的抽象的setTimeout()&放大器; 的setInterval()功能
  2. 彗星,它可以让你将数据发送到浏览器,而不浏览器中明确提出要求。
  1. Use jQuery timer plugin which abstract setTimeout() & setInterval() functions
  2. Comet, it will allow you to send data to the browser without the browser explicitly request it.

这篇关于jQuery的,阿贾克斯或PHP:运行脚本在特定的时间或在后台执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆