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.
如何增加变量中的秒数?
增加日期..:
date("m/d/Y h:i:s a", time() + 30);
但我想这样做:
$seconds = 59; $increase = 3; $result = $seconds + $increase; // 62
我希望它在 60 秒前停止并重新计算,结果应该变成 2 而不是 60
你想要模数运算符:
$seconds = 59; $increase = 3; $result = ($seconds + $increase) % 60; // 2