如何在单击时删除按钮/单击php中的按钮替换时间

如何在单击时删除按钮/单击php中的按钮替换时间

<form action="" method="POST">
    <button name="click" class="click">Click me!</button>
</form>

<?php
    if (isset($_POST["click"])){
     $currentDateTime = new \DateTime();
     //set timeZone
     $currentDateTime->setTimezone(new \DateTimeZone('Singapore'));
     $dateTime = $currentDateTime->format('H:i');
     echo $dateTime;
    }
    ?>
zcshou 回答:如何在单击时删除按钮/单击php中的按钮替换时间

我想您是在说这件事:

<?php
    if (isset($_POST["click"])){
     $currentDateTime = new \DateTime();
     //set timeZone
     $currentDateTime->setTimezone(new \DateTimeZone('Singapore'));
     $dateTime = $currentDateTime->format('H:i');
     echo $dateTime;
    }else{echo '<form action="" method="POST"><button name="click" class="click">Click me!</button></form>';}
    ?>
本文链接:https://www.f2er.com/3158917.html

大家都在问