百度
360搜索
搜狗搜索

帝国CMS自动刷新首页的方法详细介绍

这篇文章主要为大家介绍了帝国CMS自动刷新首页的方法,通过js调用php页面实现定时刷新首页的功能,是帝国CMS二次开发中一个比较典型的应用,具有一定的参考借鉴价值,需要的朋友可以参考下

本文实例讲述了帝国自动刷新首页的方法。分享给大家供大家参考。具体实现方法如下:

在首页模板中加入下面代码,尽量放在底部.

代码如下: <script language="script" type="text/" src="/e/index/index_html."></scr
ipt>

在 /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");

requ
ire LoadLang("pub/fun.php");

require("../data/dbcache/class.php");

require("../data/dbcache/MemberLevel.php");

include("../class/chtmlfun.php");

$link=db_connect();

$empire=new query();

$filepath_s="indehc.txt";

$time=time();

@$filemtime=(int)filemtime($filepath_s)+1200;

/*

函数解释

file_exists() 函数检查文件或目录是否存在。

mkdir() 函数创建目录。

time() 函数返回当前时间的 时间戳。

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自动刷新首页的方法"浏览人数已经达到45次,如你需要查询该站的相关权重信息,可以点击进入"Chinaz数据" 查询。更多网站价值评估因素如:帝国CMS自动刷新首页的方法的访问速度、搜索引擎收录以及索引量、用户体验等。 要评估一个站的价值,最主要还是需要根据您自身的需求,如网站IP、PV、跳出率等!