帝国cms 开启动态(帝国CMS怎么自动刷新首页)
导读:帝国CMS怎么自动刷新首页?...
帝国CMS怎么自动刷新首页?
本文实例讲述了帝国CMS自动刷新首页的方法 。分享给大家供大家参考 。具体实现方法如下:
推荐学习《帝国cms教程》
在首页模板中加入下面代码,尽量放在底部.
代码如下:
<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>在 /e/ 建立文件夹 htmlindex 并设置 777权限,将下面代码保存在 /e/htmlindex/index_html.php,修改刷新时间,将文件中1200改为你想要的时间,单位为秒.
代码如下:
<?php require("../class/connect.php"); include("../class/db_sql.php"); include("../class/config.php"); include("../class/functions.php"); include("../class/t_functions.php"); require LoadLang("pub/fun.php"); require("../data/dbcache/class.php"); require("../data/dbcache/MemberLevel.php"); include("../class/chtmlfun.php"); $link=db_connect(); $empire=new mysqlquery(); $filepath_s="indexhtmlhc.txt"; $time=time(); @$filemtime=(int)filemtime($filepath_s)+1200; /* 函数解释 file_exists() 函数检查文件或目录是否存在 。 mkdir() 函数创建目录 。 time() 函数返回当前时间的 Unix 时间戳 。 filemtime() 函数返回文件内容上次的修改时间 。 */ if (!file_exists($filepath_s)){ fopen($filepath_s, w); @chmod($filepath_s, 0777); ReIndex(); }elseif(!file_exists($filepath_s) || (filemtime($filepath_s)+1200)<time()){ fopen($filepath_s, w); @chmod($filepath_s, 0777); ReIndex(); }else{ // do nothing } db_close(); $empire=null; ?>创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!