【发布时间】:2010-09-16 01:59:29
【问题描述】:
echo $_POST["name"]; //returns the value a user typed into the "name" field
我也希望能够返回密钥的文本。在此示例中,我想返回文本“名称”。我可以这样做吗?
【问题讨论】:
echo $_POST["name"]; //returns the value a user typed into the "name" field
我也希望能够返回密钥的文本。在此示例中,我想返回文本“名称”。我可以这样做吗?
【问题讨论】:
array_keys($_POST)
【讨论】:
检查 array_keys() 函数,假设这是 PHP。
【讨论】:
$_POST 只是一个普通的关联数组,因此您也可以像这样循环整个内容:
foreach($_POST as $key=>$value)
{
echo "$key=$value";
}
【讨论】:
while( list( $field, $value ) = each( $_POST )) {
echo "<p>" . $field . " = " . $value . "</p>\n";
}
【讨论】:
@Tim:缺少一个)。所以应该是:
while( list( $field, $value ) = each( $_POST )) {
echo "<p>" . $field . " = " . $value . "</p>\n";
}
【讨论】:
foreach($_POST as $rvar)
{
$rvarkey=key($_POST)
$$rvarkey=mysql_real_escape_string($rvar);
}
it creates variables having the name of the request parameters which is pretty awesome.
【讨论】: