问题
When using PhpStorm, when attempting to do a $_POST request on localhost, the actionable function or page I wish to direct to does not receive any data in either $_POST or $_REQUEST, however when doing a $_GET request, it does work and data is sent.
test.php page...
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<body>
<form action="test2.php" method="post">
<input type="text" name="queryform"/>
<input type="submit" value="submit"/>
<hr/>
</form>
</body>
</html>
test2.php page...
<?php
print_r($_REQUEST);
- PhpStorm version 2016.3.2
- PHP language level 7.1
- CLI Interpreter 7.1.1
- OS = macSierra
Issue appears to effect me regardless of what php language and cli interpreter I use
回答1:
Problem appears to be specific to PhpStorm as issue can be reproduced on another machine running windows 10
Fix
When placing test.php and test2.php into my XAMPP 7.1 localhost directory, the issue does not appear, this also resolves the issue when placing files into WAMP directory on windows 10
来源:https://stackoverflow.com/questions/42262855/phpstorm-post-request-not-working-get-request-does-on-localhost