今天给各位分享帝国cms时间函数的知识,其中也会对帝国cms文库进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
- 1、如何在帝国cms首页加上“最后更新时间”
- 2、首页调用日期型字段 怎样才能只显示 月和日 不显示 年 帝国cms
- 3、帝国cms 批量定时审核 代码 或者插件 我知道帝国cms 可以设置任务自动刷新首页和栏目
1、如何在帝国cms首页加上“最后更新时间”
将以下自定义函数 放到include/extend.func.php 中
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*文章发布多少时间前*/
function tranTime($time) {
$rtime = date("m-d H:i",$time);
$htime = date("H:i",$time);
$time = time() - $time;
if ($time 60) {
$str = '刚刚';
}
elseif ($time 60 * 60) {
$min = floor($time/60);
$str = $min.'分钟前';
}
elseif ($time 60 * 60 * 24) {
$h = floor($time/(60*60));
$str = $h.'小时前 '.$htime;
}
elseif ($time 60 * 60 * 24 * 3) {
$d = floor($time/(60*60*24));
if($d==1)
$str = '昨天 '.$rtime;
else
$str = '前天 '.$rtime;
}
else {
$str = $rtime;
}
return $str;
}
函数: tranTime()
其实就是用上这个自定义函数 就可以了
?php
echo tranTime($mytime);
?
DEDE用法
列表页 [field:pubdate function="tranTime(@me)" /]
内容页 {dede:field.pubdate function="tranTime(@me)"/}
2、首页调用日期型字段 怎样才能只显示 月和日 不显示 年 帝国cms
?=date('m-d',$bqr[newstime])?
不知道你是不是要灵动标签调用,这里给出的是灵动标签的调用方法。date是格式化时间的函数,单引号里是日期格式,Y-m-d是2015-11-04这种格式,Y代表年m代表月d也就是day,你自己看着写,‘-’是连接符,也可以自己换成中文。比如'm月d日',显示的就是11月04日这种格式。
有什么疑问欢迎咨询7n7z资源网。
3、帝国cms 批量定时审核 代码 或者插件 我知道帝国cms 可以设置任务自动刷新首页和栏目
在首页模板中加入下面代码,尽量放在底部。
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()){
fopen($filepath_s, 'w');
@chmod($filepath_s, 0777);
ReIndex();
}else{
// do nothing
}
db_close();
$empire=null;
?
关于帝国cms时间函数和帝国cms文库的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。