仍然得到:'填充$ HTTP_RAW_POST_DATA已被弃用'改变之后

时间:2017-08-23 17:05:10

标签: php header warnings

每当我提交表单执行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

我没有注释并确定它是-1。我也切换到php 7并重新启动了我的Wamp服务器。我还在php元素之后检查了空格。不过我仍然收到错误信息。

还有什么可能呢?

的script.php

<?php
parse_str(file_get_contents("php://input"), $_POST);
$link = mysqli_connect("127.0.0.1", "root", "", "izandb");

if(isset($_POST['submit'])) {

$klas = $_POST['klasDown'];
$naam = $_POST['naamTxt'];
$percentages = $_POST['percentages'];
$antwoorden = $_POST['antwoorden'];

$stmt = $link->prepare('
INSERT INTO resultaten (Klas, Naam, Percentages, Antwoorden)
VALUES (?, ?, ?, ?)
');
    $stmt->bind_param('ssss', $klas, $naam, $percentages, $antwoorden);
    $stmt->execute();

    echo "Insertion succeed";
}

1 个答案:

答案 0 :(得分:0)

我重新启动了我的电脑,但它有效