您的位置:首页 > 编程语言 > PHP开发

使用php://input

2012-07-09 10:43 169 查看
就是一个输入流, 可以获得POST的原始数据.

echo file_get_contents("php://input");

//示例代码

//test.html

<html>

<head>

<!--set title-->

<title> test php://input </title>

</head>

<!--show page-->

<body>

<form action = "input.php" method="post">

用户名: <input type="text" name="user"> <br>

密码:<input type="password" name="password"> <br>

<input type="submit">

</form>

</body>

</html>
<html>

<head>

<!--set title-->

<title> test php://iput web </title>

</head>

<!--show page-->

<body>

<?php

echo"post data: <br>/n";

echofile_get_contents("php://input");

?>

</body>

</html>

<html>
<head>
<!--set title-->
<title> test php://iput web </title>
</head>
<!--show page-->
<body>
<?php
echo "post data: <br>/n";
echo file_get_contents("php://input");
?>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: