Добавить iblock/request.md
This commit is contained in:
12
iblock/request.md
Normal file
12
iblock/request.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
### Получаем POST в формате JSON**
|
||||||
|
```php
|
||||||
|
use Bitrix\Main\Context;
|
||||||
|
$request = Context::getCurrent()->getRequest();
|
||||||
|
$request->getJsonList()->get('id')
|
||||||
|
```
|
||||||
|
|
||||||
|
### Отправка ответа в формате json
|
||||||
|
```php
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($res_data,JSON_UNESCAPED_UNICODE);
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user