tomcat無法接受post資料

2021-08-14 04:15:25 字數 826 閱讀 5625

在專案中由於前端傳輸的資料過大,後台無法接受post資料.

原因: tomcat預設傳輸資料大小為2m

嘗試方法:

tomcat 配置檔案 server.xml 中

maxpostsize="52428800"/>其中

maxpostsize="0"
如果配置成 0 可以解決,嘗試了一下,發現可以接受成功,但是之後發現無法接受其他的介面傳輸的post資料.

解決方法:配置maxpostsize為具體的大小

maxpostsize="52428800"

發現還是傳輸過程中會出現失敗的情況,

因為httppost不僅是大小會限制,還會有時間限制。雖然你可以上傳,但是在connectiontimeout的限制時間內不能傳完,連線也會斷開的。

後將預設的connectiontimeout=」20000」 放大10倍試試,成功!

最後的配置樣式:

maxpostsize="52428800"/>尚未驗證其他出現的問題,如有其他的問題請指教

如果使用php無法接受post的值

在出現這種情況的時候需要檢查我們header頭中的引數 content type 的值 php input可以讀取沒有處理過的post資料。相較於 http raw post data而言,它給記憶體帶來的壓力較小,並且不需要特殊的php.ini設定。php input不能用於enctype mul...

express接受post請求引數

express接受post引數需要引入乙個核心模組 body parser const bodyparser require body parser 然後應用到express例項上 server.use bodyparser.json server.use bodyparser.urlencoded...

php 只能接受get 接受不到POST值

一 php獲取post資料的幾種方法 方法1 最常見的方法是 post fieldname 解釋 也就是表單post過來的資料 方法2 file get contents php input 說明 允許讀取 post 的原始資料。和 http raw post data 比起來,它給記憶體帶來的壓力...