我在一个php文件中观察这段代码,这是一个strtotime函数。请告诉我' -1-1'的含义在以下功能中。
strtotime($ year。' -1-1')
答案 0 :(得分:0)
这是连接到任何一年的结束日期的月份和日期..
如果$ year = 2016,则与撰写strtotime('2016-1-1');
答案 1 :(得分:0)
strtotime()将您的时间字符串转换为Unix时间戳。
例如:
strtotime("now") returns 1461336078
strtotime("3 October 2005") returns 1128312000
strtotime("+5 hours") returns 1461354078 and so on.
在你的情况下,你的时间串是" 2016-1-1",如果$ year = 2016.也就是说,strtotime($ year。' -1-1&# 39);将返回您在$ year变量中提供的任何一年的第一天的时间戳,只需将您的年份与' -1-1'连接即可。