file_get_contents("php://input", "r")實例介紹
更新時間:2013年07月01日 09:40:33 作者:
本篇文章是對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/>";
?>
index.html
復(fù)制代碼 代碼如下:
<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
復(fù)制代碼 代碼如下:
<?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/>";
?>
相關(guān)文章
探討多鍵值cookie(php中cookie存取數(shù)組)的詳解
本篇文章是對多鍵值cookie(php中cookie存取數(shù)組)進行了詳細的分析介紹,需要的朋友參考下2013-06-06PHP實現(xiàn)創(chuàng)建一個RPC服務(wù)操作示例
這篇文章主要介紹了PHP實現(xiàn)創(chuàng)建一個RPC服務(wù)操作,結(jié)合實例形式分析了PHP基于socket擴展通信實現(xiàn)的RPC遠程調(diào)用相關(guān)操作技巧,需要的朋友可以參考下2020-02-02過濾掉PHP數(shù)組中的重復(fù)值的實現(xiàn)代碼
去除一個數(shù)組中的重復(fù)值,可以使用foreach方法,也可以使用array_unique方法,下面的代碼兩種方法都使用了。2011-07-07php使用function_exists判斷函數(shù)可用的方法
這篇文章主要介紹了php使用function_exists判斷函數(shù)可用的方法,通過一個圖像處理函數(shù)中使用function_exists函數(shù)判斷并輸出來實現(xiàn)函數(shù)存在判斷與流程靈活控制的功能,具有很好的借鑒價值,需要的朋友可以參考下2014-11-11