php简单的判断用户登陆
1.html代码
<form action="test.php" method="post" enctype="multipart/form-data"> <input type="text" name="username"><br> <input type="password" name="password"><br> <input type="submit" value="提交"> </form>
2.test.php代码
<?php //$res=[]; //$res['username']=$_POST['username']; //$res['password']=$_POST['password']; //var_dump($res); $username = $_POST['username']; $password = $_POST['password']; if ($username == '' || is_null($username || empty($username))) { echo '姓名不能为空'; } elseif ($password == '' || is_null($password || empty($password))) { echo '密码不能为空'; } else { echo 'a'; }