Extends Request.
Retrieve attributes derived from the request.
array
Example:
$_SESSION['user_name'] = 'terrylin'; $_SESSION['user_role'] = 'admin'; $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $serverRequest = $serverRequest-> withAttribute('session', $_SESSION)-> withAttribute('ip_address', $_SERVER['REMOTE_ADDR']); $attributes = $serverRequest->getAttributes(); echo $attributes['session']['user_name']; // Outputs: terrylin echo $attributes['ip_address']; // Outputs: 127.0.0.1
There was an error while loading. Please reload this page.