我是PHP新手,我想在html代碼中添加2個月到特定日期。我該怎麼做?請指導我,如何在HTML代碼中的PHP中添加2個月的日期?
這是我使用的代碼:
private function inputExpiryDate() {
$value = $this->expiryDate;
$html = "";
$html .= '<label for="expirydate">Expiry Date:</label>';
$html .= '<input type="text" readonly name="expirydate" id="expirydate" value="'.$value.'">';
$html .= '<input type="button" id="expirydatebutton" onclick="getExpiryDate()">' . PHP_EOL;
return $html;
}
問題是,我將如何添加此
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 month"); ??
任何幫助非常感謝。
當你添加$ value = strtotime(date(「Ymd」,strtotime($ value))。「+1 month」)時會發生什麼;在$ html =「」;?之前? – Osiris