Swoole\Http\Request->post

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

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

Parameters

None

Return

Array

Description

The Swoole\Http\Request->post is an array which contains POST data from the HTTP request. This array is equivalent to the PHP super global $_POST variable, you should use Swoole\Http\Request->post instead.

Example

<?php

$server->on('Request', function(Swoole/Server/Request $request, Swoole/Server/Response $response)
{
    // Access one POST parameter
    echo $request->post['hello'];

    // See the whole request POST array
    var_dump($request->post);
});

Notes

  • The POST and Header size combined must not exceed package_max_length otherwise the server won't be able to process the request and will consider it malicious

  • The POST parameters must not exceed 128

Last updated on August 31, 2022