$ _POST方法不起作用$ _GET

时间:2016-03-06 14:59:20

标签: php

我根本无法让$ _POST方法起作用。 相反,$ _GET包含数据

我使用Postman通过POST和GET方法进行测试: Screenshot

Server PHP Settings

请求:***。rising-games.net/posttest.php?test=Something

<?php
echo "Request method: " . $_SERVER['REQUEST_METHOD'] . "<br><br>";

//-------------------------------------------
//  POST output
//-------------------------------------------
if (isset ($_POST ["test"]))
    echo "Post 'Test' is: " . $_POST ['test'] . "<br>";
else
    echo "Post 'test' is empty!<br>";

//-------------------------------------------
//  Get output
//-------------------------------------------
if (isset ($_GET ["test"]))
    echo "Get 'Test' is: " . $_GET ['test'] . "<br>";
else
    echo "Get 'test' is empty!<br>";

//-------------------------------------------
//  Request output
//-------------------------------------------
if (isset ($_REQUEST ["test"]))
    echo "Request 'Test' is: " . $_REQUEST ['test'];
else
    echo "Request 'test' is empty!";

&GT;

1 个答案:

答案 0 :(得分:0)

您尝试使用发布请求。但是您将test参数的值设置为不是请求的邮件正文,而是设置参数http://www.rising-games.net/posttest.php?test=Something

在Postman中试试这个: enter image description here