1. 程式人生 > 其它 >帝國CMS自動重新整理首頁的方法

帝國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; ?>

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