[請益] 關於php multipart curl問題請益

看板PHP作者 (鄉民我來了)時間10年前 (2015/05/12 14:22), 編輯推噓2(202)
留言4則, 3人參與, 最新討論串1/1
當我使用 curl -X POST http://localhost.com/test.php -F "a=bbbb" 時 結果: array(1) { ["a"]=> string(4) "bbbb" } 抓的到POST資料 可是當我加入 -H 的資料 curl -X POST http://localhost.com/test.php -H "Cache-Control: no-cache" -H "Postman-Token: 6e468ce3-b9e0-4502-65ff-a08eed133c55" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "a=bbbb" 結果: array(0) { } 就抓不到資料了 test.php內容: <?php var_dump($_POST); 想請問我的用法是哪裡有用錯?? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.34.142.39 ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1431411752.A.8F6.html

05/12 17:34, , 1F
改用 \n 把 -H 的內容接起來吧~
05/12 17:34, 1F

05/13 09:21, , 2F
請問用\n接起來就可以的原理是什麼?我試了之後是ok了..
05/13 09:21, 2F

05/13 09:40, , 3F
跳脫字元
05/13 09:40, 3F

05/13 09:45, , 4F
普通的斷行
05/13 09:45, 4F
文章代碼(AID): #1LKPmeZs (PHP)
文章代碼(AID): #1LKPmeZs (PHP)