设置时间,将变量添加到天数


Setting strtotime adding a variable to amount of days

我正在尝试导出一定天数并将其设置为变量 $max_future。目前这是一个固定的天数,但我希望用户输入变量是它拥有的数字。

目前设置为:

$max_future = date("Y-m-d", strtotime($today . "+6 days"));

我想要这样的东西:

$exportDays = '9'; //(or whatever the user input was)
$max_future = date("Y-m-d", strtotime($today . "+$exportDays days"));

这可能吗?我感谢任何帮助

尝试:

$max_future = date("Y-m-d", strtotime($today . "+" . $exportDays . " days"));

像这样

<?php
$output = 9; // you can take this value from input.
$today = date("Y-m-d");
echo date('Y-m-d', strtotime($today. ' +'.$output. ' days'));
?>
<?php
    $exportDays = $_REQUEST['exportDays']; // or however you want to get it from user input
    $max_date = date('Y-m-d', strtotime(date('Y-m-d') . ' +' . $exportDays . ' days'));