php://input
是一个输入流,可以获得 POST 的原始数据;
用法: echo file_get_contents("php://input");
例子:
a.html
XML/HTML代码
- <form action="b.php" method="post">
- <input type="text" name="user">
- <input type="password" name="password">
- <input type="submit">
- </form>
PHP代码
- <?php
- header("Content-Type:text/html; charset=utf-8");
- $file_in = file_get_contents( "php://input");
- echo urldecode($file_in);
- file_put_contents('php://output',$file_in);
- //$doc = new DOMDocument();
- //$doc -> loadXML($file_in);
- ?>

