Swoole\Http\Request->post

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