简体   繁体   English

GET 有效但 POST 在 PHPStorm 中无效

[英]GET works but POST doesn't work in PHPStorm

I have a simple HTML form:我有一个简单的 HTML 表格:

 <form class="form-signin" action="formHandler.php" method="post">
                        <h2 class="form-signin-heading">Login</h2>
                        </br>
                        </br>
                        <label for="inputUsername" class="sr-only">Benutzername</label>
                        <input type="inputUsername" name="inputUsername" id="inputUsername" class="form-control" placeholder="Username" required autofocus>
                        <label for="inputPassword" class="sr-only">Password</label>
                        <input type="password" name="inputPassword" id="inputPassword" class="form-control" placeholder="Password" required>
                        </br>
                        <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
                        <button class="btn btn-lg btn-primary btn-block" type="clear">Clear</button>
                    </form>

which I send to the following PHP script:我将其发送到以下 PHP 脚本:

var_dump($_POST);
var_dump($_GET);

When I use GET, my variables get passed correctly.当我使用 GET 时,我的变量得到正确传递。 However, when I use post (as in the example) var_dump($_POST) returns an empty array.但是,当我使用 post(如示例中)时,var_dump($_POST) 返回一个空数组。

After extensive searching, I found out that the issue is rooted in PHPStorm's local environment.经过广泛搜索,我发现问题根源于 PHPStorm 的本地环境。 The POST request works fine when the site is deployed to a local Apache environment or when uploaded to a website.当站点部署到本地 Apache 环境或上传到网站时,POST 请求工作正常。

The problem is documented on IntelliJ website:该问题记录在 IntelliJ 网站上:

POST Problem with PHPStorm 10.02 and onwards PHPStorm 10.02 及更高版本的 POST 问题

Jetbrains issuetracker with the issue in question:有问题的 Jetbrains issuetracker:

https://youtrack.jetbrains.com/issue/WI-31257 https://youtrack.jetbrains.com/issue/WI-31257

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM