PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC ]); return $pdo; } function body() { $raw = file_get_contents("php://input"); $j = json_decode($raw, true); return is_array($j) ? $j : $_POST; } function out($ok, $msg, $data = [], $status = 200) { http_response_code($status); header("Content-Type: application/json"); echo json_encode(["ok" => $ok, "msg" => $msg] + $data); exit; }