帝国CMS自动刷新首页的方法
帝国CMS自动刷新首页的方法。分享给大家供大家参考。具体实现方法:
在首页模板中加入下面代码,尽量放在底部.
代码:
<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>
在 /e/ 建立文件夹 htmlindex 并设置 777权限,将下面代码保存在 /e/htmlindex/index_html.php,修改刷新时间,将文件中1200改为你想要的时间,单位为秒.
代码:
<?phprequire("../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;
?>
声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至201542412@QQ.com举报,一经查实,本站将立刻删除。
相关推荐
-
帝国cms灵动标签调用友情链接的代码
用灵动标签调用首页的友情链接,标签中的20为要循环调用的数量,可以根据自己需求修改。
-
帝国CMS根据标题生成图片的函数
关键词生成图片栏目ID,信息ID,背景图片宽度,背景图片高度,背景图片
-
帝国cms制作模板发布于10秒前 1周前 1个月前 函数
帝国cms制作模板发布于10秒前1周前1个月前函数
-
如何使用万能标签调用帝国CMS指定时间内容
如何使用万能标签调用帝国CMS指定时间内容
-
帝国cms列表内容模板实现多图不同样式方法代码
帝国cms多图不同样式展示,列表内容模板(list.var)(*)代码如下:注意:一定要勾选(使用程序代码)