[英]how to remove a button when clicked / click the button replace time in php
how to remove a button when clicked / click the button replace time in 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;
}
?>
I think you are telling about this:我想你在说这个:
<?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>';}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.