帝國CMS自動刷新首頁的方法
帝國CMS自動刷新首頁的方法。分享給大家供大家參考。具體實現方法:
在首頁模板中加入下面代碼,盡量放在底部.
?
代碼:
<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;?
/*?
函數解釋?
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)<time()){
fopen($filepath_s, 'w');?
@chmod($filepath_s, 0777);?
ReIndex();?
}else{?
// do nothing?
}?
db_close();?
$empire=null;?
?>
?
聲明:本文內容由互聯網用戶自發貢獻,該文觀點僅代表作者本人。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如發現本站有涉嫌抄襲侵權/違法違規的內容, 請發送郵件至201542412@QQ.com舉報,一經查實,本站將立刻刪除。
相關推薦
-
帝國cms靈動標簽調用友情鏈接的代碼
用靈動標簽調用首頁的友情鏈接,標簽中的20為要循環調用的數量,可以根據自己需求修改。
-
帝國CMS根據標題生成圖片的函數
關鍵詞生成圖片欄目ID,信息ID,背景圖片寬度,背景圖片高度,背景圖片
-
帝國cms制作模板發布于10秒前 1周前 1個月前 函數
帝國cms制作模板發布于10秒前1周前1個月前函數
-
如何使用萬能標簽調用帝國CMS指定時間內容
如何使用萬能標簽調用帝國CMS指定時間內容
-
帝國cms列表內容模板實現多圖不同樣式方法代碼
帝國cms多圖不同樣式展示,列表內容模板(list.var)(*)代碼如下:注意:一定要勾選(使用程序代碼)















