关于本站
“最难不过坚持”
本人承接扒站仿站,php网站维护,病毒查杀,网站编辑,网站改版,html制作
有需要网站维护,改版,病毒查杀,网站编辑,网站备案,html制作等相关的工作可以联系我。
本人有多年相关工作经验,也可提供免费咨询,交个朋友。
有需要探讨问题的朋友,也可以加我微信,共同探讨!
微信:15011482830 QQ:408917339
2712
39
分类目录
最新评论
- https://jueru.net/
-
评 留言
- :weixiao:
-
评 留言
- :shuijiao: :weiqu: :zhenbang: :leng:
-
评 留言
- :yiwen: :yiwen: :yiwen: :yiwen:
-
评 EasySass: could not generate CSS file. See Output panel for details.
- 这个业务逻辑多少都有点奇怪了,阅读浏览次数增值在新闻详情页的控制器方法里setInc,这怎么还写进模型事件里了。如果非要用onAfterRead也可以,把新闻文章的内容单独分出来一个news_content表,然后把它和news做关联,然后给news_content表的onAfterRead事件做增值处理,这样点进新闻页内查询到文章内容时才会触发它。
-
评 TP6模型事件-查询后onAfterRead不好用
文章标签更多
php毫秒倒计时,前台js活动展示倒计时,后台计算倒计时时间。每0.1秒定时刷新活动倒计时时间。
php代码:
<?php
// 注意:php的时间是以秒算。js的时间以毫秒算
// 设置时区
date_default_timezone_set('PRC');
// 配置每天的活动时间段
$starttimestr = date('Y-m-d H:i:s', strtotime(date('Y-m-d')));
$endtimestr = date('Y-m-d H:i:s', strtotime(date('Y-m-d', strtotime('+1 day'))));
$starttime = strtotime($starttimestr);
$endtime = strtotime($endtimestr);
$nowtime = time();
if ($nowtime < $starttime) {
exit("活动还没开始,活动时间是:{$starttimestr}至{$endtimestr}");
}
if ($endtime >= $nowtime) {
$lefttime = $endtime - $nowtime; //实际剩下的时间(秒)
} else {
$lefttime = 0;
exit("活动已经结束!");
}
// echo '剩余时间:' . $lefttime . '秒';
?>
前台js代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PHP+JS活动秒杀倒计时原理</title>
</head>
<body>
<h1>活动开始时间:2019-04-24 00:00:00</h1>
<h1>活动结束时间:2019-04-25 00:00:00</h1>
<h4>距离活动结束还有 <strong id="RemainD"></strong>天
<strong id="RemainH"></strong>小时
<strong id="RemainM"></strong>分钟
<strong id="RemainS"></strong>.<strong id="RemainL"></strong>秒
</h4>
<script>
var runtimes = 0;
function GetRTime() {
var lefttime = 3876 * 1000 - runtimes * 1000;
if (lefttime >= 0) {
var nD = Math.floor(lefttime / (1000 * 60 * 60 * 24)) % 24;
var nH = Math.floor(lefttime / (1000 * 60 * 60)) % 24;
var nM = Math.floor(lefttime / (1000 * 60)) % 60;
var nS = Math.floor(lefttime / 1000) % 60;
document.getElementById("RemainD").innerHTML = nD;
document.getElementById("RemainH").innerHTML = nH;
document.getElementById("RemainM").innerHTML = nM;
document.getElementById("RemainS").innerHTML = nS;
if (lefttime == 5 * 60 * 1000) {
alert("还有最后五分钟!");
}
runtimes++;
setTimeout("GetRTime()", 1000);
} else {
alert('活动结束了!');
location.reload();
}
}
var Num = 0;
onload = function() {
Refresh();
setInterval("Refresh();", 100);
GetRTime();
}
function Refresh() {
if (Num < 10) {
document.getElementById("RemainL").innerHTML = Num;
Num = Num + 1;
} else {
Num = 0;
}
}
</script>
</body>
</html>
赏
相关推荐
php实现ZIP压缩文件解压缩,中文乱码解决方法(重要)
直接上代码,具体代码里面都有注释。直接中文压缩文件解压到中文文件夹。
<?php
// 需开启配置 php_zip.dll
// phpinfo();
header("Content-type:text/html;charset=utf-8");
/*
* $filename 被解压文件名
* $path 解压...
openssl_private_decrypt解密失败
复制别人的解密程序,原程序可以解密,复制过来就不可以
一步步尝试发现,秘钥换行符有区别,
原秘钥有换行符,复制过来不知道什么时候把换行符清空了,成了一行字符串了。
评论加载中...
前一篇: PHP冒泡排序算法