MkyTaP - 開發筆記
主要工具: Linux, Python, SQL
Tuesday, August 6, 2019
PHP: send request to php, empty $_POST
在使用postman發送請求到PHP時,無法從php拿到$_POST的參數。
1. 檢查有沒有header: Content-Type: application/json
2. 使用下面語句,重置$_POST來源
$rest_json = file_get_contents("php://input");
$_POST = json_decode($rest_json, true);
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment