這篇文章將為大家詳細講解有關(guān)帝國CMS如何自動刷新首頁,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

成都創(chuàng)新互聯(lián)公司是一家專業(yè)提供白朗企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站制作、做網(wǎng)站、外貿(mào)營銷網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計、小程序制作等業(yè)務(wù)。10年已為白朗眾多企業(yè)、政府機構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站設(shè)計公司優(yōu)惠進行中。
帝國CMS怎么自動刷新首頁?
在首頁模板中加入下面代碼,盡量放在底部.
代碼如下:
<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>
在 /e/ 建立文件夾 htmlindex 并設(shè)置 777權(quán)限,將下面代碼保存在 /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;
/*
函數(shù)解釋
file_exists() 函數(shù)檢查文件或目錄是否存在。
mkdir() 函數(shù)創(chuàng)建目錄。
time() 函數(shù)返回當(dāng)前時間的 Unix 時間戳。
filemtime() 函數(shù)返回文件內(nèi)容上次的修改時間。
*/
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;
?>關(guān)于帝國CMS如何自動刷新首頁就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
網(wǎng)頁名稱:帝國CMS如何自動刷新首頁
分享URL:http://www.chinadenli.net/article32/pesdsc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、營銷型網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計公司、服務(wù)器托管、靜態(tài)網(wǎng)站、手機網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)