vc用戶端發送如下2份資料給php server解析,分別是administrator:123與abc.txt,使用$_FILES可以接收到abc.txt檔案,但怎麼才能接收到name="user"與----MULTI-PARTS-FORM-DATA-BOUNDARY之間的administrator:123呢?接收到資料後,怎麼把administrator:123添加到abc.txt檔案的第一行?請高手指點一下。謝謝!
----MULTI-PARTS-FORM-DATA-BOUNDARY
Content-Disposition: form-data; name="user"
administrator:123----MULTI-PARTS-FORM-DATA-BOUNDARY
Content-Disposition: form-data; name="upload"; filename="abc.txt"
Content-Type: text/plain
verify:local
id:1111
host:2.2.2.2
id:2222
host:3.3.3.3
id:3333
host:4.4.4.4
回複討論(解決方案)
print_r($_SERVER); 能看到什麼
這個函數好像是取不到資料的,有其它的辦法嗎?
資料量不大可以寫入header,例如作為cookies
還好,其實我不太清楚怎麼取出Content-Disposition: form-data; name="user"
administrator:123中的administrator:123資料,真的沒有人知道了嗎?
問題是 Content-Disposition 通常是用在伺服器端向用戶端傳送的header,很少反向這樣用的吧?
其實你還可以把一些不重要的值作為url用$_GET擷取啊……
問題是 Content-Disposition 通常是用在伺服器端向用戶端傳送的header,很少反向這樣用的吧? //這個不見得,繼續請高手指點啊,感謝
print_r($_POST);
print_r($_FILES);
試試這兩個
觀察
print_r($_FILES);
print_r($_POST);
echo file_get_contents('php://input');
的結果
使用$_POST解決,感謝各位啦!