doutuzhuohao6449 2018-04-27 22:04
浏览 41

虽然$ _Get工作正常但$ _POST方法无法正常工作

<?php
//    include_once '../include/user_functions.php';
    if(isset($_POST['btn'])){
        $data=$_POST['frm'];
//        user_login($data);
        var_dump($_POST['frm']);
    }
?>
<!DOCTYPE html>
<html lang="fa">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="img/favicon.html">
    <title>FlatLab - Flat & Responsive Bootstrap Admin Template</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-reset.css" rel="stylesheet">
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet" />
</head>

  <body class="login-body">

    <div class="container">

      <form class="form-signin" action="" method="post">
        <h2 class="form-signin-heading">login now</h2>
        <div class="login-wrap">
            <input type="text" class="form-control" placeholder="username" name="frm[username]"autofocus>
            <input type="password" class="form-control" name="frm[password]" placeholder="password">
            <label class="checkbox">
                <input type="checkbox" value="remember-me">remember me
                <span class="pull-right"> <a href="#"> forget password?</a></span>
            </label>
            <button class="btn btn-lg btn-login btn-block" value="btn-button" name="btn" >login</button>

        </div>

      </form>

    </div>


  </body>
</html>
  1. When i change form method to get that works fine.

  2. when i use browser network tab headers form data has value

  3. When I change if(isset($_POST['btn'])) to vardump($_POST) it return array(0) { } all the time.

  4. I run php on xampp

upload_max_filesize=130M post_max_size=130M

any additional information needed?

  • 写回答

1条回答 默认 最新

  • duankuai6991 2018-04-27 22:56
    关注

    I think your issue is your use of the Content Security Policy Header "Upgrade Insecure Requests" which has a couple of minor bugs when used over plain (insecure) HTTP.

    Because your localhost is HTTP this might be interrupting the POST data because the "Upgrade Insecure Requests" header is trying to send to a HTTPS address and so might be blocking (stripping) out the POST data when finding it can't reach .

    Please try and disable your "upgrade insecure requests" header (and possibly clear your browser cache) and see if this helps your issue?

    It may also depend on the browser used, as CSP is only currently on some browsers.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?