linux 帝国cms 刷新,帝国CMS自动刷新首页的方法
本文实例讲述了帝国CMS自动刷新首页的方法。分享给大家供大家参考。具体实现方法如下:
在首页模板中加入下面代码,尽量放在底部.
复制代码
代码如下:
在 /e/ 建立文件夹 htmlindex 并设置 777权限,将下面代码保存在 /e/htmlindex/index_html.php,修改刷新时间,将文件中1200改为你想要的时间,单位为秒.
复制代码
代码如下:
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)
fopen($filepath_s, ‘w’);
@chmod($filepath_s, 0777);
ReIndex();
}else{
// do nothing
db_close();
$empire=null;
?>
希望本文所述对大家的帝国CMS建站有所帮助。
原文链接:https://blog.csdn.net/weixin_33880392/article/details/117018587?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166669233216800182716617%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=166669233216800182716617&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-25-117018587-null-null.nonecase&utm_term=%E5%B8%9D%E5%9B%BDcms