php無法獲取form數(shù)據(jù)怎么辦-創(chuàng)新互聯(lián)

如何解決php獲取不到form數(shù)據(jù)?

創(chuàng)新互聯(lián)公司公司2013年成立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目成都網(wǎng)站制作、網(wǎng)站建設(shè)網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元保定做網(wǎng)站,已為上家服務(wù),為保定各地企業(yè)和個人服務(wù),聯(lián)系電話:18982081108

問題解決 修改php.ini配置

找到php.ini配置文件,查找enable_post_data_reading變量,修改為打開狀態(tài),注釋掉句前分好

; Whether PHP will read the POST data.
; This option is enabled by default.
; Most likely, you won't want to disable this option globally. It causes $_POST
; and $_FILES to always be empty; the only way you will be able to read the
; POST data will be through the php://input stream wrapper. This can be useful
; to proxy requests or to process the POST data in a memory efficient fashion.
; http://php.net/enable-post-data-reading
enable_post_data_reading = On    //大約656行,修改此條

修改配置后,發(fā)現(xiàn)還是不行,繼續(xù)查閱資料。

獲取非表單數(shù)據(jù)

搜集資料之后,發(fā)現(xiàn)vue-axios向后端post的是非表單數(shù)據(jù)(Ajax不同),在獲取非表單數(shù)據(jù)時需要用php://input

$raw = file_get_contents('php://input');//獲取非表單數(shù)據(jù)echo $raw;//輸出結(jié)果
PS:post時前端請求頭要設(shè)置為
headers: {    "Content-type": "application/json; charset=utf-8"}

以上就是如何解決php獲取不到form數(shù)據(jù)的詳細(xì)內(nèi)容,更多請關(guān)注創(chuàng)新互聯(lián)其它相關(guān)文章!

本文題目:php無法獲取form數(shù)據(jù)怎么辦-創(chuàng)新互聯(lián)
文章URL:http://muchs.cn/article12/hepdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計公司、網(wǎng)站設(shè)計品牌網(wǎng)站制作、外貿(mào)網(wǎng)站建設(shè)、全網(wǎng)營銷推廣網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化