Php time call problems do not understand php programming at all, please ask: want to implement, * minutes ago (* hours ago ...), I don't know how to compile it. I found a piece of code on the Internet, which is easy to use and simple: PHPcode & lt ;? Phpfunctionformat_time ($ time) {$ t = time ()-$ time; $ f = array (php time call problem
I don't know much about php programming. please refer:
I want to implement it. I don't know how to compile it. I found a piece of code on the Internet, which is very easy to use. it is also very simple:
PHP code
'Year', '000000' => 'month', '000000' => 'week', '000000' => 'day ', '000000' => 'Hourly ', '60' => 'mine', '1' => 'second'); foreach ($ f as $ k => $ v) {if (0! = $ C = floor ($ t/(int) $ k) {return $ c. $ v. 'pre' ;}} echo format_time ('20140901');?>
However, the time here needs to be converted to the Unix timestamp, and a piece of code is also found:
PHP code
The page code is as follows:
PHP code
",strtotime($row["pay_time"]))?>
Question: How do I integrate the above three codes to implement what I need? * minutes ago (* hours ago?
------ Solution --------------------
PHP code
'Year', '000000' => 'month', '000000' => 'week', '000000' => 'day ', '000000' => 'Hourly ', '60' => 'mine', '1' => 'second'); foreach ($ f as $ k => $ v) {if (0! = $ C = floor ($ t/(int) $ k) {return $ c. $ v. 'pre' ;}}while ($ row = mysql_fetch_array ($ rs_tmmsm) {echo format_time (strtotime ($ row ["pay_time"]);}?>