欢迎光临 - 我的站长站,本站所有资源仅供学习与参考,禁止用于商业用途或从事违法行为!

帝国cms教程

帝国CMS教程自动刷新首页函数

帝国cms教程 我的站长站 2013-06-10 共1021人阅读

在首页模板中加入下面代码,尽量放在底部。
<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函数
  • 二次开发中常用的过滤函数

    (1)、数字型变量可以用(int)或intval函数处理,例子:$page=(int)$_GET[&#39;page&#39;];或$page=intval($_GET[&#39;page&#39;]);(2)、带小数点的数字型变量可以用(float)或floatval函数处理,例子:$money=(float)$money;或$money=floatval($money);(3)、...

    帝国cms教程 206 4年前
  • 帝国CMS在文章内容页添加百度是否已收录查询函数功能

    后台帝国CMS收录查询功能截图这个功能之前我的站长站www.wdzzz.com有发过,这次是利用帝国CMS函数的方法。[xxid]17,497[/xxid]找到e/class/userfun.php,在里面添加如下代码://监测百度是否收录function okBaidu($url){$url=&#39;http://www.baidu.com/...

    帝国cms教程 242 4年前
  • 评论时间显示刚刚发布插件
    评论时间显示刚刚发布插件

    使用一个时间转换函数,在时间输出到页面的时候转换一下即可。function TimeTurner($time) {$minute = date("H:i",$time); $hour = date("H:i",$time); $alltime = date...

    帝国cms插件 487 9年前
  • 帝国CMS手机号码生成图片格式插件
    帝国CMS手机号码生成图片格式插件

    使用方法。下载压缩包解压到自己网站的任意目录。使用方法 文件地址/phone.php?phone=手机号码调用方法。在模板中用 例如phone.php在根目录 <img src="/phone.php?phone...

    帝国cms插件 782 9年前
  • 帝国cms二次开发函数对应文件目录分享
    帝国cms二次开发函数对应文件目录分享

    reuserlistall() /e/class/chtmlfun.php line 303testcj() /e/install/data/fun.php line 192reuserjsall() /e/class/chtmlfun.php line 326sys_showtextpageselect() /e/class/t_functions...

    帝国cms教程 341 8年前