将天数转换为 Unix 时间戳

Oli*_*sen -2 php timestamp

可能的重复:
如何在 php 中为 unix 时间戳添加 24 小时?

如何将天数转换为unixtimestamp?

例如,如果用户在表单中输入 55(=55 天),我希望将 55 天添加到当前时间,然后将其存储在 unix 时间戳中。

Tim*_*per 5

算术time()

$input = (int) $_POST['days'];
$timestamp = time() + $input * 86400;
Run Code Online (Sandbox Code Playgroud)

或者也许使用strtotime()

$input = (int) $_POST['days'];
$timestamp = strtotime('+' . $input ' days');
Run Code Online (Sandbox Code Playgroud)