Introduction: This is a timeline development in PHP. It is displayed as a detailed page of "just", "5 minutes ago", "Yesterday", and so on, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 356091 'rolling = 'no'>
The timeline development in PHP is displayed as "just", "5 minutes ago", "Yesterday", etc.
In fact, this does not have any technical content, of course, it will be directly postedCode, No nonsense (Hefei tourism network ),
However, it is quite useful in development, such as Forum posts and collars.
// Time transform function: http://weyou.wehefei.com/function trantime ($ time ){
$ Rtime = date ("M-d h: I", $ time );
$ Htime = date ("H: I", $ time );
$ Time = Time ()-$ time;
If ($ time <60 ){
$ STR = 'gang ';
}
Elseif ($ time <60*60 ){
$ Min = floor ($ time/60 );
$ STR = $ min. 'minute ago ';
}
Elseif ($ time <60*60*24 ){
$ H = floor ($ time/(60*60 ));
$ STR = $ H. 'hour before '. $ htime;
}
Elseif ($ time <60*60*24*3 ){
$ D = floor ($ time/(60*60*24 ));
If ($ d = 1)
$ STR = 'Yesterday '. $ rtime;
Else
$ STR = 'day before Day'. $ rtime;
}
Else {
$ STR = $ rtime;
}
Return $ STR;
}
The $ time parameter in the trantime () function must be a Unix timestamp. If not, use strtotime () to convert it to a Unix timestamp. The above code is clear at a glance, and you don't need to talk about it more (Hefei tourism network ).
Call the function and directly output the following:
$ Times = "1286861696 ";
Echo trantime ($ times );
Source: http://lab.wehefei.com/posts/410
Welcome to: http://weyou.wehefei.com/
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/356091.html pageno: 2.