顶部横幅广告
  • 微信
您当前的位置:首页 > 技术学习 > 帝国cms

帝国cms如何设置自动刷新首页

作者:石德生 时间:2022-04-06 阅读数:人阅读文章来源:网络
帝国cms静态页面是无法自动刷新的,我们每次发布文章都需要手动的去刷新数据。而且对于访问者浏览次数,点击数也需要我们手动刷新之后才会展示在前台,那该如何解决这一问题呢?
在后台设置首页模板处放入下列代码,至于底部即可
<script language="javascript" type="text/javascript" src="/e/html/index_html.php"></script>

在网站根目录找到e文件夹,在e文件夹内新建html文件夹设置权限777,在文件夹内部新建index_html.php文件。代码具体如下
<?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)+600;
/*
函数解释
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)+600)
fopen($filepath_s, 'w');
@chmod($filepath_s, 0777);
ReIndex();
}else{
// do nothing
}
db_close();
$empire=null;
?>

上方600单位为秒,可以自行根据需要设置。
 
 
 
 

本站部分文章、数据、图片来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了你的权益请来信告知我们删除。邮箱:1737618317@qq.com

标签:
微信

石德生

当你还撑不起你的梦想时,就要去奋斗。如果缘分安排我们相遇,请不要让她擦肩而过。我们一起奋斗!

微信
上云折上折

猜你喜欢

    无相关信息