일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- FK 설정
- 백준알고리즘
- BC렌트
- Lesson2
- Lesson3
- 부산입국
- 데이터의 무결성
- FLEX5
- IntelliJ
- Linux
- 파이도 환불
- 설탕문제
- 1463번
- 벤쿠버집구하기
- codility
- 언마운트
- database연결
- FIDO 환불
- Java
- 엔테크서비스
- 레노보노트북
- 프로그래머스
- 캐나다워홀
- 리눅스
- 벤쿠버 렌트
- 벤쿠버렌트
- binaray_gap
- 자바
- 외래키설정
- QA엔지니어
- Today
- Total
대충이라도 하자
getParsedBody() 와 getBody() + Postman에서 test 본문
There are two types which you can bring the data from the body in PHP.
1. getParsedBody()
: return as an array type
2.getBody()
: return as an object type, json
When using getParsedBody(), you need to choose ' x-www-form-urlccoded' on Postman.
On the other hasd, for getBody(), you need to choose raw -> json on Postman.
For example, you gonna bring these data from the body.
{
"contacts": {
"emails": [
"yg2222@cheilpengtai.com"
]
}
}
- for getParsedBody() & x-www-form-urlcoded
=> contacts is an array having email and phone number
=> At the same time, email could be more than two, so it has to be an array type as well.
=> key has to be contacts[] for one array, contacts[email][] for two
- for getBody() & raw->json
=> just put the data as json .
'꼬꼬마 개발자 노트 > PHP' 카테고리의 다른 글
fetch the total data in the easier way (0) | 2021.12.13 |
---|---|
변수 VS 상수 , 컴파일 시, 런타임시 (0) | 2021.12.10 |
PHP의 Magic Method (0) | 2021.12.03 |
PHP 에러 : Array to string conversion in php (0) | 2021.11.29 |