1
0
Fork 0
php-coding/10.work1.php

37 lines
1.3 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>练习1</title>
</head>
<body>
<form method="post" action="">
<label for="year1">:</label>
<input type="text" name="year" id="year1">
<label for="month1">:</label>
<input type="text" name="month" id="month1">
<label for="day1">:</label>
<input type="text" name="day" id="day1">
<label for="hour1">:</label>
<input type="text" name="hour" id="hour1">
<label for="minute1">:</label>
<input type="text" name="minute" id="minute1">
<label for="second1">:</label>
<input type="text" name="second" id="second1">
<input type="submit" value="提交">
</form>
<?php
if (isset($_POST['year']) && isset($_POST['month']) && isset($_POST['day']) && isset($_POST['hour']) && isset($_POST['minute']) && isset($_POST['second'])) {
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
$hour = $_POST['hour'];
$minute = $_POST['minute'];
$second = $_POST['second'];
// display the results
// echo '你输入的时间为:' . $year . '年' . $month . '月' . $day . '日' . $hour . '时' . $minute . '分' . $second . '秒';
$time = mktime($hour, $minute, $second, $month, $day, $year);
echo date('Y-m-d H:i:s',$time);
}
?>
</body>