rfc:parse_request_body_in_json
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:parse_request_body_in_json [2018/10/02 15:59] – created jhdxr | rfc:parse_request_body_in_json [2018/10/02 16:57] (current) – fix typo jhdxr | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Add support | + | ====== PHP RFC: Add support |
* Version: 0.1 | * Version: 0.1 | ||
* Date: 2018-10-02 | * Date: 2018-10-02 | ||
Line 11: | Line 11: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | It's very common for javascript library to send JSON payload now, however, PHP doesn' | + | It's very common for javascript library to send JSON payload now, however, PHP doesn' |
+ | |||
+ | For example, | ||
+ | < | ||
+ | curl -i -H " | ||
+ | </ | ||
+ | will get | ||
+ | <code php> | ||
+ | var_dump($_POST); | ||
+ | /* | ||
+ | array(2) { | ||
+ | [" | ||
+ | string(3) " | ||
+ | [" | ||
+ | int(456) | ||
+ | } | ||
+ | */ | ||
+ | </ | ||
+ | |||
+ | Some edge cases: | ||
+ | - illegal data: If the payload cannot be decoded, '' | ||
+ | - scalar type value: If the payload is a simple scalar type value, like numbers, string, TRUE or FALSE, '' | ||
+ | - large number value: Large number will be stored as string, which means '' | ||
rfc/parse_request_body_in_json.1538495942.txt.gz · Last modified: 2018/10/02 15:59 by jhdxr