OpenSwoole\Http\Request->post

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

Declaration

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

Parameters

None

Return

Array

Description

The OpenSwoole\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 OpenSwoole\Http\Request->post instead.

Example

<?php

$server->on('Request', function(OpenSwoole\Server\Request $request, OpenSwoole\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 September 20, 2022