域名后面的端口怎么隱藏 PHP后臺怎么接收post請求的參數(shù)?
PHP后臺怎么接收post請求的參數(shù)?1、$Post[“paramname”]只有當(dāng)內(nèi)容類型為application/x-www-form-urlencoded或multipart/form data
PHP后臺怎么接收post請求的參數(shù)?
1、$Post[“paramname”]只有當(dāng)內(nèi)容類型為application/x-www-form-urlencoded或multipart/form data時(shí),PHP才會在Post全局變量中填充HTTP請求包$ody的相應(yīng)部分,PHP忽略所有其他情況。填充到$ post數(shù)組中的數(shù)據(jù)是urldecode()解析的結(jié)果。
2、文件獲取內(nèi)容(”php://輸入)對于大多數(shù)類型的內(nèi)容類型php://允許輸入讀取post的原始數(shù)據(jù)。和$http_uuraw_uuuuuuuupost_uuuu相比,它對內(nèi)存的壓力更小,不需要任何特殊的內(nèi)存php.ini文件設(shè)置。php://無法輸入與enctype=“multipart/form data”一起使用。
3、$GLOBALS[“HTTPurawuuupostData”]始終生成$HTTPurawuuupostData變量包含原始POST數(shù)據(jù)。此變量僅在遇到無法識別的MIME類型的數(shù)據(jù)時(shí)生成。$HTTP RAW POST Data對于enctype=“multipart/form Data”表單數(shù)據(jù)不可用。
如果PHP無法識別post數(shù)據(jù),則可以使用$globals[“httpRAWuuupostdata”],例如text/XML或soap。需要設(shè)置php.ini文件Always in_uuPopulate_uuuRaw_uuuuuuuPost_uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu。在后來的版本中,變量$httpRAWPOSTThis特性在php5.6.0中被搶占,在php7.0.0中被刪除。一般來說,php://輸入應(yīng)該是代替$HTTPRAWPOSTDATA使用。