Skip to content

Commit db04517

Browse files
authored
Update login.php
1 parent 502a5e6 commit db04517

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

denlu/login.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
session_start();
33

4-
// 简单的用户存储(在实际项目中应使用数据库)
5-
$users = isset($_SESSION['users']) ? $_SESSION['users'] : array();
6-
74
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
5+
// 简单的用户存储(在实际项目中应使用数据库)
6+
$users = isset($_SESSION['users']) ? $_SESSION['users'] : array();
7+
88
$email = $_POST['email'];
99
$password = $_POST['password'];
1010

@@ -19,6 +19,8 @@
1919

2020
echo '邮箱或密码无效';
2121
} else {
22-
echo '无效的请求方法';
22+
// 返回405错误
23+
http_response_code(405);
24+
echo '方法不允许';
2325
}
2426
?>

0 commit comments

Comments
 (0)