- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務(wù)經(jīng)營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會理事單位
- 安全聯(lián)盟認證網(wǎng)站身份V標(biāo)記
- 域名注冊服務(wù)機構(gòu)許可:滇D3-20230001
- 代理域名注冊服務(wù)機構(gòu):新網(wǎng)數(shù)碼
織夢dedecms定時自動更新首頁的方法如下:
1、在 根目錄/plus 目錄下新建一個php文件,命名為:autoindex.php
2、將以下代碼復(fù)制到 autoindex.php 文件
<?php
function sp_input( $text )
{
$text = trim( $text );
$text = htmlspecialchars( $text );
if (!get_magic_quotes_gpc())
return addslashes( $text );
else
return $text;
}
$autotime = 3600;//自動更新時間,單位為秒,這里我設(shè)為一小時,大家可以自行更改。
$fpath = "../data/last_time.inc";//記錄更新時間文件,如果不能達到目的,請檢查是否有讀取權(quán)限。
include( $fpath );
if( empty($last_time))
$last_time = 0;
if( sp_input($_GET['renew'])=="now")
$last_time = 0;
if((time()-$last_time)>=$autotime )
{
define('DEDEADMIN', ereg_replace("[/\]{1,}",'/',dirname(__FILE__) ) );
require_once(DEDEADMIN."/../include/common.inc.php");
require_once(DEDEINC."/arc.partview.class.php");
/*
$row = $dsql->GetOne("select * from dede_homepageset");
$dsql->Close();
$templet=$row['templet'];
$position=$row['position'];
*/
$templet = “tnbjh/index.htm”;//這里是首頁模板位置,當(dāng)前是dede默認首面位置。
$position = "../index.html";
$homeFile = dirname(__FILE__)."/".$position;
$homeFile = str_replace("\", "/", $homeFile );
$homeFile = str_replace( "//", "/", $homeFile );
$pv = new PartView();
$pv ->SetTemplet( $cfg_basedir.$cfg_templets_dir."/".$templet );
$pv -> SaveToHtml( $homeFile );
$pv -> Close();
$file = fopen( $fpath, "w");
fwrite( $file, "<?php ");
fwrite( $file,"$last_time=".time()."; ");
fwrite( $file, '?>' );
fclose( $file );
}
?>
3、在首頁模板的<head></head>標(biāo)簽中加入如下代碼
<script src="/plus/autoindex.php" language="javascript"></script>
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP