2016-03-06 122 views
-2

我简直无法让$ _POST方法工作。 而不是$ _GET包含的数据

我用邮差通过POST测试和GET方法: Screenshot

Server PHP Settings

请求:*** rising-games.net/posttest.php?test =东西

<?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!"; 

?>

+0

的可能重复[PHP:注意:未定义的变量和注意事项:未定义指数(HTTP ://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) –

回答

0

您尝试使用POST请求。但是,你设置的test参数没有价值信息的请求主体,但得到的参数http://www.rising-games.net/posttest.php?test=Something

在邮差试试这个: enter image description here

+0

我做了,它的工作。谢谢^^但我的get不像你的那样空虚。 – Rhutos

+0

因为我发送请求到http://www.***.net/posttest.php而没有获取参数。如果它工作,请将此问题标记为已接受:) –