构建服务器中的PhpStorm未找到post参数且无法修改标头信息错误

时间:2016-04-26 20:40:18

标签: php html ide phpstorm

我目前正在学习PHP,我决定从我的常规编辑器+ WAMP配置切换到JetBrains PhpStorm,在复制粘贴我之前做的几个例子之后我发现它的内置服务器行为不正常(对我来说)至少)。

目前,我有一个包含两个文件的项目设置:

的index.html:

<html>
<body>

<form action="welcome.php" method="post">
    Name: <input type="text" name="name"><br>
    E-mail: <input type="text" name="email"><br>
    <input type="submit">
</form>

</body>
</html>

的welcome.php:

<html>
<body>

Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>

</body>
</html>

这是来自W3schools的基本PHP表单example,它在我的WAMP配置上按预期工作,但是当我在输入电子邮件和名称后使用PhpStorm运行它时,我在welcome.php上得到以下输出:

Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0
Welcome
Notice: Undefined index: name in D:\deve\PhpstormProjects\untitled\welcome.php on line 4

Your email address is:
Notice: Undefined index: email in D:\deve\PhpstormProjects\untitled\welcome.php on line 5

..$HTTP_RAW.....Cannot modify header information...警告显示无论在welcome.php上运行什么php脚本,但只有PHP 5.6,而我使用PHP 7.0解释器时没有相同的警告。

..Undefined index..错误仅在我使用post方法时显示。

我试过了:

  • 重新安装
  • 尝试几种不同的PHP版本:PHP 7.0(解决了第一对 错误),5.6.20和5.6.16 x86和x64
  • always_populate_raw_post_data设置为不同的值,包括-1没有区别

再次值得一提的是,我在WAMP上没有任何问题。我在那里使用PHP 5.6.16。任何帮助都是赞赏这个东西按预期工作!

0 个答案:

没有答案