帝国CMS教程自动刷新首页函数
发布时间:2022-02-01作者:帝国建站网
在首页模板中加入下面代码,尽量放在底部。
<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;
?>相关帝国教程
- 06-04帝国CMS7.0商城提交订单后跳转到订单列表页的方法
- 03-17帝国CMS内容页和会员中心怎么调用是否实名认证的会员
- 04-19帝国CMS模板下载最终页模板调用带图片软件信息
- 12-09帝国cms数据表phome_ecms_news_doc_data
- 12-19帝国CMS模板中调用用户投稿头像
- 07-22帝国CMS替换当前位置导航[!---newsnav--]标签
- 11-11帝国cms二次开发留言板自定义字段教程
- 10-31帝国cms编辑器跨站漏洞
- 04-21帝国cms自动提取简介时不想自动回车
- 11-03帝国CMS二次开发高效的随机调用方法
- 01-20帝国cms列表页显示新闻或软件简介时
- 09-16phome_enewspicclass 数据表字段解释(图片信息分类表)
- 09-11帝国cms后台忘记登录密码怎么办
- 04-11帝国cms教程:修改d目录
- 05-29帝国CMS新订单、新反馈信息、新投稿 各种场景 各种给管理员发通知邮件
- 02-10帝国CMS灵动标签调用相关文章的方法
- 12-06帝国wap内容模板里过滤掉图片尺寸的方法
- 06-15帝国CMS模板自定义页面用PHP获取页面ID、名称、标题、关键词、描述、内容等
- 10-02帝国CMS收藏删除功能的另类方法
- 07-26帝国CMS自定义列表页调用会员信息