帝国CMS教程自动刷新首页
发布:smiling 来源: PHP粉丝网 添加日期:2014-11-22 11:41:02 浏览: 评论:0
在首页模板中加入下面代码,尽量放在底部.
<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()){ //开源软件:phpfensi.com
 - fopen($filepath_s, 'w');
 - @chmod($filepath_s, 0777);
 - ReIndex();
 - }else{
 - // do nothing
 - }
 - db_close();
 - $empire=null;
 - ?>
 
Tags: 帝国CMS自动刷新 帝国CMS首页
- 上一篇:帝国CMS获取当前栏目下面的子栏目
 - 下一篇:帝国CMS列表页面调用关键字TAG
 
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
 - PHP新手上路(一)(7)
 - 惹恼程序员的十件事(5)
 - PHP邮件发送例子,已测试成功(5)
 - 致初学者:PHP比ASP优秀的七个理由(4)
 - PHP会被淘汰吗?(4)
 - PHP新手上路(四)(4)
 - 如何去学习PHP?(2)
 - 简单入门级php分页代码(2)
 - php中邮箱email 电话等格式的验证(2)
 
