首页 > 站长资源 > 建站技术建站技术 订阅

帝国CMS自动刷新首页的方法

时间:2022-10-31 18:33:01 栏目:建站技术
【导读】:猫站网址导航(https://www.hduuu.com)在线提供,建站技术「帝国CMS自动刷新首页的方法」,供建站技术爱好者免费阅读。本文地址:https://www.hduuu.com/news/827.html

本文实例讲述了帝国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;  
?>
标签:

版权声明:

1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。

2、本站仅提供信息发布平台,不承担相关法律责任。

3、若侵犯您的版权或隐私,请联系本站管理员删除。

4、文章来源:https://www.cnblogs.com/ninama/p/16019506.html

上一篇:返回列表 下一篇:返回列表

建站技术导航

建站技术热点

建站技术推荐

本网站所有的文章都转载与网络(版权为原作者)我们会尽可能注明出处,但不排除来源不明的情况。转载是处于提供更多信息以参考使用或学习、交流、科研之目的,不用于商业用途。转载无意侵犯版权,如转载文章涉及您的权益等问题,请作者速来电话和邮件告知,我们将尽快处理。