国产欧美日韩第一页|日本一二三不卡视频|在线精品小视频,亚洲第一免费播放区,metcn人体亚洲一区,亚洲精品午夜视频

帝國(guó)CMS自動(dòng)刷新首頁(yè)的方法

2016-12-03 18:46:37 11932

帝國(guó)CMS自動(dòng)刷新首頁(yè)的方法


這篇文章主要為大家介紹了帝國(guó)CMS自動(dòng)刷新首頁(yè)的方法,通過(guò)js調(diào)用php頁(yè)面實(shí)現(xiàn)定時(shí)刷新首頁(yè)的功能,是帝國(guó)CMS二次開發(fā)中一個(gè)比較典型的應(yīng)用,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了帝國(guó)CMS自動(dòng)刷新首頁(yè)的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

在首頁(yè)模板中加入下面代碼,盡量放在底部.


代碼如下:

<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>


在 /e/ 建立文件夾 htmlindex 并設(shè)置 777權(quán)限,將下面代碼保存在 /e/htmlindex/index_html.php,修改刷新時(shí)間,將文件中1200改為你想要的時(shí)間,單位為秒.


代碼如下:

<?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)前時(shí)間的 Unix 時(shí)間戳。 
filemtime() 函數(shù)返回文件內(nèi)容上次的修改時(shí)間。 
*/ 
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; 
?>


希望本文所述對(duì)大家的帝國(guó)CMS建站有所幫助。

提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問(wèn)題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問(wèn)題: