首頁 > CMS教程 > 帝國CMS > 主體

帝國CMS自動刷新首頁的方法

silencement
發布: 2019-11-27 14:03:19
轉載
2042 人瀏覽過

帝國CMS自動刷新首頁的方法

本文範例講述了帝國CMS自動刷新首頁的方法。分享給大家供大家參考。具體實作方法如下:

在首頁範本中加入下面程式碼,盡量放在底部.

#程式碼如下:

<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>
登入後複製

在/e/ 建立資料夾htmlindex 並設定777權限,將下面程式碼儲存在/e/htmlindex/index_html.php,修改刷新時間,將檔案中1200改為你想要的時間,單位為秒.

推薦學習《帝國cms教學

程式碼如下:

<?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, &#39;w&#39;);
@chmod($filepath_s, 0777);
ReIndex();
}elseif(!file_exists($filepath_s) || (filemtime($filepath_s)+1200)<time()){
fopen($filepath_s, &#39;w&#39;);
@chmod($filepath_s, 0777);
ReIndex();
}else{
// do nothing
}
db_close();
$empire=null;
?>
登入後複製

希望本文所述對大家的帝國CMS建站有所幫助。

以上是帝國CMS自動刷新首頁的方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:www.word666.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!