打开一个网页,让网页每隔一定时间刷新
<META HTTP-EQUIV=REFRESH CONTENT='60;URL=index.php'>

解决方案 »

  1.   

    可以定时执行 但是
    比较困难 如果没有触发点 实现很难
    必须有触发 比如用户访问 
    搜了半天就有个这样的解决办法 参考一下吧
    =================================================
    如何定時自動執行PHP script
    又是一個困擾很久的問題,
    嘗試過各種各樣的方法,雖然最後以javascript小時鐘定時執行來暫時解決,
    不過該方法還是很笨,今天終於有了一個好的solution,
    而且這種方法可以延伸很多應用,趕快記下來,以免以後忘記
    1. 寫一個vbs檔,其實就照抄就好,裡面怎麼運行,你不想知道也沒關係
      不過大概就是呼叫httpRequest這個物件去撞你的php script,就好像AJAX一樣,
      以下是這個HttpRequester.vbs的寫法:
     
    ' For more WinHTTP v5.0 info, including where to get
    ' the component, see our HTTP sample:
    ' http://www.asp101.com/samples/winhttp5.asp
    Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5")
    objWinHttp.Open "GET", strURL
    objWinHttp.Send
    ' Get the Status and compare it to the expected 200
    ' which is the code for a successful HTTP request:
    ' http://www.asp101.com/resources/httpcodes.asp
    If objWinHttp.Status <> 200 Then
     ' If it's not 200 we throw an error... we'll
     ' check for it and others later.
     Err.Raise 1, "HttpRequester", "Invalid HTTP Response Code"
    End If
    ' Since in this example I could really care less about
    ' what's returned, I never even check it, but in
    ' general checking for some expected text or some sort
    ' of status result from the ASP script would be a good
    ' idea.  Use objWinHttp.ResponseText
    Set objWinHttp = Nothing
    If Err.Number <> 0 Then
     ' Something has gone wrong... do whatever is
     ' appropriate for your given situation... I'm
     ' emailing someone:
     Dim objMessage
     Set objMessage = Server.CreateObject("CDO.Message")
     objMessage.To       = "Jimmy <[email protected]>"
     objMessage.From     = "Jimmy <[email protected]>"
     objMessage.Subject  = "An Error Has Occurred in a " _
      & "Scheduled Task"
     objMessage.TextBody = "Error #: " & Err.Number & vbCrLf _
      & "From: " & Err.Source & vbCrLf _
      & "Desc: " & Err.Description & vbCrLf _
      & "Time: " & Now()
           
     objMessage.Send
     Set objMessage = Nothing
    End If2. 將這個檔案存起來,然後造一個bat檔,裡面寫
    C:\Your Path To\HttpRequester.vbs http://localhost/your_path_to/sample.php
     
    3.用定時排程去定時呼叫這個bat,大功告成
     
    簡單的方法,但是還是要有門路接觸到他!
    2006-09-19補充
    也可以試試另一個方法
    1. 造一個geturl.wsf的Jscript
     <package>
    <job>
    <script language="JScript">
    var oXML = new ActiveXObject("Microsoft.XMLHTTP");
    oXML.open("GET", WScript.Arguments.Item(0), false); 
    oXML.send();
    WScript.Echo(oXML.responseText);
    </script>
    </job>
    </package>
     
    2. 造一個bat檔,裡面寫
    cscript C:\Your Path To\geturl.wsf http://localhost/your_path_to/sample.php
     
    3. 設定排程,大功告成
     
    因為發現某些機器上不能用第一種方法,因此又去找來第二種可以work的方法^^
      

  2.   

    可以用PHP命令行接口结合系统的计划任务来实现定时执行.我这样做过.
      

  3.   

    参照http://blog.csdn.net/oyoung/archive/2006/03/08/618582.aspx