卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章11179本站已运行3223

帝国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)

卓越飞翔博客
上一篇: 帝国CMS会员信息调用方法
下一篇: 帝国CMS灵动标签获取当前栏目下面的子栏目
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏