OpenSwoole\Http\Request->getMethod()

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\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(OpenSwoole\Server\Request $request, OpenSwoole\Server\Response $response)
{
    var_dump($request->server['request_method']);
    var_dump($request->getMethod());
});
Last updated on September 20, 2022