武汉SEO
时光静好,与君语;细水流年,与君同;繁华落尽,与君老...

个人日记>正文

帝国CMS怎么实现自动刷新首页功能

2024-05-03 16:48 gbl

这篇文章给大家分享的是有关帝国CMS怎么实现自动刷新首页功能的内容。小编觉得挺实用的,因此分享给大家做个参考。一起跟随小编过来看看吧。

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

代码如下:

<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>

在 /e/ 建立文件夹 htmlindex 并设置 777权限,将下面代码保存在 /e/htmlindex/index_html.php,修改刷新时间,将文件中1200改为你想要的时间,单位为秒.

代码如下:

<?phprequire("../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怎么实现自动刷新首页功能就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到吧!


本文链接:https://www.0937.biz/post-3190.html

图文推荐
热门标签