php file_get_contents(php://input, r)

时间:2016-05-09
本篇文章是对file_get_contents("php://input", "r")的实例进行了详细的介绍,需要的码农参考下。

直接上例子

index.html

<form action="action.php" method="post" >
  <input type="text" name="userName"  id="userName" /><br/>
  <input type="text" name="userPass"  id="userPass" /><br/>
  <input type="submit" value="ok" />
 </form>

action.php

<?php
$raw_post_data = file_get_contents('php://input', 'r');
echo "-------\$_POST------------------<br/>";
echo var_dump($_POST) . "<br/>";
echo "-------php://input-------------<br/>";
echo $raw_post_data . "<br/>";
?> 

php file_get_contents("php://input", "r") 实例讲解

php file_get_contents("php://input", "r") 实例讲解