欢迎来到入门教程网!

帝国cms

当前位置:主页 > CMS教程 > 帝国cms >

帝国CMS自动刷新首页的方法

来源:本站原创|时间:2020-01-11|栏目:帝国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;
?>

希望本文所述对大家的帝国CMS建站有所帮助。

上一篇:帝国cms使用灵动标签实现当前栏目高亮的方法

栏    目:帝国cms

下一篇:帝国CMS结合项提示“您来自的链接不存在”的解决方法

本文标题:帝国CMS自动刷新首页的方法

本文地址:https://www.xiuzhanwang.com/a1/diguocms/12408.html

网页制作CMS教程网络编程软件编程脚本语言数据库服务器

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

Copyright © 2002-2020 脚本教程网 版权所有