帝国cms定时设置自动刷新手机端页面的方法
<?php define('EmpireCMSAdmin','1');require("../class/connect.php");require("../class/db_sql.php");require("../class/functions.php");require LoadLang("pub/fun.php");require("../class/t_functions.php");require("../data/dbcache/class.php");require("../data/dbcache/MemberLevel.php"); $link=db_connect(); $empire=new mysqlquery(); @set_time_limit(0);//防止时间过期$num=1;//可以设置get获取参数echo'相减的时间<br />';echo $time_x=strtotime('now')-strtotime('today') ;//从凌晨开始算时间到现在为多少秒$ee1=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_news"); //统计文章条数$ee2=96;//每96条为一组$ee3=fmod($ee1,$ee2);//余数$ee4=$ee1/$ee2 ; $ee5=floor($ee4);//商if($ee3!=0){ $ee5=$ee5+1;//如果除不尽那么再多一组}echo '一共'.$ee1.'条'.$ee5.'组这是第'.$num.'组<br />'; $s_n=($num-1)*$ee2; $s_nx=$ee2;if($ee5==$num){ $s_nx=$ee2-($ee5*$ee2-$ee1); }//die("select * from {$dbtbpre}ecms_news order by newstime limit $s_n,$s_nx");$sql=$empire->query("select * from {$dbtbpre}ecms_news order by id desc limit 5"); $i=0; //while($r=$empire->fetch($sql)){//循环获取查询记录$id=$r['id']; GetHtml($r['classid'],$id,$r,0); } db_close(); $empire=null; ?>
2、刷新手机端首页,找到e/后台文件夹下面的ecmschtml.php,注析掉以下代码:
//验证用户$lur=is_login(); $logininid=$lur['userid']; $loginin=$lur['username']; $loginrnd=$lur['rnd']; $loginlevel=$lur['groupid']; $loginadminstyleid=$lur['adminstyleid']; hCheckEcmsRHash();
3、最后在linux的corntab设置
/usr/bin/curl http://手机域名/e/后台文件夹/refreshed.php0 /usr/bin/curl http://手机域名/e/后台文件夹/ecmschtml.php?enews=ReIndex