const res = await fetch('php/test.php', {
method:'POST',
body: JSON.stringify({'data': '222'})
})
const json = await res.json()
console.log(json)<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$a = json_decode($_POST['data']);
echo json_encode(['test'=>$a]);
}{test: null}