- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務經(jīng)營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會理事單位
- 安全聯(lián)盟認證網(wǎng)站身份V標記
- 域名注冊服務機構許可:滇D3-20230001
- 代理域名注冊服務機構:新網(wǎng)數(shù)碼
帝國CMS自動刷新首頁的方法
這篇文章主要為大家介紹了帝國CMS自動刷新首頁的方法,通過js調(diào)用php頁面實現(xiàn)定時刷新首頁的功能,是帝國CMS二次開發(fā)中一個比較典型的應用,具有一定的參考借鑒價值,需要的朋友可以參考下
本文實例講述了帝國CMS自動刷新首頁的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
在首頁模板中加入下面代碼,盡量放在底部.
代碼如下:
<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>
在 /e/ 建立文件夾 htmlindex 并設置 777權限,將下面代碼保存在 /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ù)返回當前時間的 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;
?>
希望本文所述對大家的帝國CMS建站有所幫助。
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP