echo_error) { header('Content-type: text/html; charset=UTF-8'); echo json_encode(['error' => 1, 'message' => $msg]); exit; } else { throw new \Exception($msg); } } }