2

我想知道是否有人可以帮助我解决如何查看$_POST请求。

我想做的是检查所有$_POST请求,而不仅仅是某些请求,$_POST['name'], $_POST['post']我想检查每个帖子,但无法知道每个 POST 请求的名称。

这是我尝试过的(片段):

foreach ($_POST as $pst)
{
    echo $pst;
}
//And tried the above for GET too. (but the GET I've manged to working.)

我也尝试了很多其他方法,我可以想出一个无法解决的问题......

4

2 回答 2

7

您使用了正确的解决方案

foreach($_POST as $key=>$value){
    //> do your operation here
    echo $key.': '.$value;
}

您可以使用$key获取参数名称

于 2011-05-31T17:41:09.557 回答
2

如果您只是想输出帖子以便您可以看到它们来解决问题,那么我会使用这样的东西:

<?php
    echo "<pre>\n";
    print_r($_POST);
    echo "</pre>\n";
    exit;
?>
于 2011-05-31T17:41:24.927 回答