更新时间:2023-01-27 21:37:56
在代码顶部添加 session_start();
;这是因为除非会话开始并且您的 $ _ SESSION ['user_name'] = $ user_name;
当前不执行任何操作,否则您无法保存会话变量.
Add session_start();
at the top of your code; it's because you can't save a session variable unless the session is started and your $_SESSION['user_name']=$user_name;
doesn't do anything currently.
And your code is vulnerable to SQL injection attacks, read this question on how to prevent them.