Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Http\Request->cookie: array
None
Array
The OpenSwoole\Http\Request->cookie
class property is an array which contains HTTP request cookie data. It is a key-value array and is equivalent to the PHP super global variable $_COOKIE
.
All the array keys are lowercase.
<?php
$server->on('Request', function(OpenSwoole\Server\Request $request, OpenSwoole\Server\Response $response)
{
echo $request->cookie['username'];
// See the whole cookie array
var_dump($request->cookie);
});