Php时间和手动设置时间值。计数秒

Php时间和手动设置时间值。计数秒,php,time,count,Php,Time,Count,今天我绞尽脑汁,做了一些搜索,但没有找到任何好的答案。 看看我的例子 $time_now = date("H:i:s"); // The current time. (let's say the clock is 14:25:33) $time_visited = "14:23:33"; // the time page was visited. (set by cookie) 假设我想得到$time\u访问的时间和$time\u now之间的秒数(应该是120秒) 在这些值之间获取/计数秒的

今天我绞尽脑汁,做了一些搜索,但没有找到任何好的答案。 看看我的例子

$time_now = date("H:i:s"); // The current time. (let's say the clock is 14:25:33)
$time_visited = "14:23:33"; // the time page was visited. (set by cookie)
假设我想得到$time\u访问的时间和$time\u now之间的秒数(应该是120秒) 在这些值之间获取/计数秒的最简单方法是什么?

()返回当前时间戳,()将给定字符串解析为

()返回当前时间戳,()将给定字符串解析为

time() - strtotime("14:23:33")