这是表单代码:
<div class="login_cont">
<form action="doLogin.php" method="post">
<ul class="login">
<li class="l_tit">管理员帐号</li>
<li class="mb_10"><input type="text" name="username" placeholder="请输入管理员帐号"class="login_input user_icon"></li>
<li class="l_tit">密码</li>
<li class="mb_10"><input type="password" name="password" class="login_input password_icon"></li>
<li class="l_tit">验证码</li>
<li class="mb_10"><input type="text" name="verify" class="login_input password_icon"></li>
<img src="getVerify.php" alt="" />
<li class="autoLogin"><input type="checkbox" id="a1" class="checked" name="autoFlag" value="1"><label for="a1">自动登陆(一周内自动登陆)</label></li>
<li><input type="submit" value="" class="login_btn"></li>
</ul>
</form>
</div>
这是doLogin.php
include_once '../include.php';
$username = $_POST['username'];
$password = md5($_POST['password']);
$verify = $_POST['verify'];
$session_verify = $_SESSION['verify'];
print_r($_POST);
var_dump($_SERVER);
为什么var_dump($ _ POST)为空?
答案 0 :(得分:0)
var_dump($ _ POST)无法为空!
当你做的时候
$username = $_POST['username'];
$password = md5($_POST['password']);
$verify = $_POST['verify'];
$session_verify = $_SESSION['verify'];
var_dump($_POST);
你会得到
array(3) { ["username"]=> string(8) "shashank" ["password"]=> string(8) "password" ["verify"]=> string(3) "123" }
var_dump($_POST);
将是
array(3) { ["username"]=> string(0) "" ["password"]=> string(0) "" ["verify"]=> string(0) "" }
因此,如果你发布了var_dump($_POST)
,那么null是否有任何意义或不可能。
有趣编辑:)
只有当您输入用户名为 null 密码时, null 等才能生成
array(3) { ["username"]=> string(4) "null" ["password"]=> string(4) "null" ["verify"]=> string(4) "null" }