如何在php中的一定时间(10秒)内自动显示nextpage?

时间:2015-11-26 06:14:15

标签: php

我有大量包含数据的页面。我想在10秒内自动显示当前页面的下一页,现在我有2个链接用于下一页和后面。但我想自动显示它。如果页面计数到达最后一页,那么它将显示第一页。

for ($counterstart=$startcounter ;
    $counterstart<=count($device)-1;$counterstart++){
    $entry = $device[$counterstart] ;     
    echo "page";    
}

if ($startcounter ==$result ){
    echo " Back ";
}else{
   echo "Next";
}           

3 个答案:

答案 0 :(得分:2)

您可以通过<meta> http-equiv属性进行以下扩充内容及时间和下一页网址

<head>
    <meta http-equiv="refresh" content="10;http://www.metatags.info/meta_http_equiv">
</head>

参考 - http://www.metatags.info/meta_http_equiv

JSFifddle

答案 1 :(得分:1)

您无法在服务器端*执行此操作。使用JavaScript:网页中的超时和Ajax来提取新内容。

搜索这些关键字会带您到大量的示例和教程。

(*)或者至少它非常复杂

答案 2 :(得分:1)

setTimeout将帮助您根据设置的时间执行任何JavaScript代码。

语法

setTimeout(code,millisec,lang)

用法,

setTimeout(nextPageFunction,10000);

有关详细信息,请http://www.w3schools.com/jsref/met_win_settimeout.asp

内部功能你可以做这样的事情

document.getElementById("NextPageButton").click();