设为首页 - 加入收藏
广告 1000x90
您的当前位置:主页 > 网站运营 > 正文

织梦dedecms首页调用随机文章实现自动更新

来源:网络分享 编辑:引流技巧 时间:2026-05-10
第一步调用随机文章: 
织梦模板给出了随机文章调用的参数如下: 


{dede:arclist sort=’rand’ titlelen=48 row=16}<li><a href="[field:arcurl/]" title="[field:title/]" target="_blank">[field:title/]</a></li>{/dede:arclist} 第二步设置定时自动更新文件: 
复制下面代码,粘贴到一个新文件中,命名为:autoindex.php,上传到ftp的plus文件夹中: 


<?php function sp_input( $text ) { $text = trim( $text ); $text = htmlspecialchars( $text ); if (!get_magic_quotes_gpc()) return addslashes( $text ); else return $text; } $autotime = 3600;//自动更新时间,单位为秒,这里我设为一小时,大家可以自行更改。 $fpath = "../data/last_time.inc";//记录更新时间文件,如果不能达到目的,请检查是否有读取权限。 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

相关推荐:

栏目分类

微商引流技巧网 www.yinliujiqiao.com 联系QQ:1716014443 邮箱:1716014443@qq.com

Copyright © 2019-2024 强大传媒 吉ICP备19000289号-9 网站地图 rss地图

Top