Swoole\Http\Request->get

Notice: the documentation is suitable for PHP extension swoole until v4.7.1, we only support PHP extension openswoole from v4.7.1

Declaration

<?php
Swoole\Http\Request->get: array

Parameters

None

Return

Array

Description

The Swoole\Http\Request->get class property is an array which contains the information of HTTP GET URL parameters. For example a URL like http://shop.co.uk/tools/hammers?price=high is where price=high will be inside the Swoole\Http\Request->get array.

This array is equivalent to the PHP super global of $_GET, you should use Swoole\Http\Request->get instead.

Example

<?php
$server->on('Request', function(Swoole/Server/Request $request, Swoole/Server/Response $response)
{
    // Show the selected price filter from the URL
    echo $request->get['price'];

    // Display all the GET parameters
    var_dump($request->get);
});

Notes

  • To prevent hash attacks, the GET parameter array must not exceed the maximum number of 128