Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图了解 $now 参数在 php 函数中的作用
strtotime(string $time [, int $now = time() ])
每个人似乎都简单地忽略了 $now 参数,并且它的文档不是很清楚。
该参数如何真正影响返回值?
它是 unix 时间戳的可选参数。如果使用,则函数中使用的当前时钟将是该值,$now否则使用当前时间戳。
$now
例如,如果您在不输入可选参数的情况下弹出“昨天”,则假定您的意思是昨天。如果您输入 1 周前的时间戳,它会为您提供一周前昨天的答案。