帝国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非首页调用网站关键词和描述的方法

下一篇:帝国cms7.5内核自适应导航站模板制作教程记录


代码 函数 时间
Copyright © 2002-2019 测速网 www.inhv.cn 皖ICP备2023010105号
测速城市 测速地区 测速街道 网速测试城市 网速测试地区 网速测试街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!

热门搜索 城市网站建设 地区网站制作 街道网页设计 大写数字 热点城市 热点地区 热点街道 热点时间 房贷计算器