帝国CMS教程自动刷新首页函数
在首页模板中加入下面代码,尽量放在底部。<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>在 /e/ 建立文件夹 htmlindex 并设置 777权限将下面代码保存在 /e/htm……
在首页模板中加入下面代码,尽量放在底部。<script language="javascript" type="text/javascript" src="/e/htmlindex/index_html.php"></script>
在 /e/ 建立文件夹 htmlindex 并设置 777权限
将下面代码保存在 /e/htmlindex/index_html.php
修改刷新时间,将文件中1200改为你想要的时间,单位为秒。
<?phprequire("../class/connect.php");include("../class/db_sql.php");include("../class/config.php");include("../class/functions.php");include("../class/t_functions.php");requireLoadLang("pub/fun.php");require("../data/dbcache/class.php");require("../data/dbcache/MemberLevel.php");include("../class/chtmlfun.php");$link=db_connect();$empire=newmysqlquery();$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{//donothing}db_close();$empire=null;?>
- 上一篇
帝国CMS万能标签和灵动标签的区别,那个比较好呢?
万能标签(ecmsinfo)和灵动标签(e:loop)是帝国CMS模板制作的两大法宝,只要会其中之一就能熟练撑握和制作帝国各种模板。今天罗哥给大家讲解一下两者的区别:万能标签(ecmsinfo)和灵动标签(e:loop)主要区别:1、万能标签需先
- 下一篇
帝国CMS 上传附件保持原文件名的方法!
帝国CMS 上传附件保持原文件名找到 /e/class/connect.php查找 $r[filetype]=GetFiletype($file_name);在下面加入$filename2=str_replace($r[filetype], '', $file_name); //获得去掉后缀的文件名$mytype = array (".