Swoole\Http\Request->getMethod()

Declaration

<?php
Swoole\Http\Request->getMethod(): string

Parameters

None

Return

String

Returns the current request HTTP method as a string

Description

Gets the method of HTTP request, so it could be GET, POST, PUT, DELETE etc.

Since version v4.6.2

Example

<?php

$server->on('Request', function(Swoole/Server/Request $request, Swoole/Server/Response $response)
{
    var_dump($request->server['request_method']);
    var_dump($request->getMethod());
});