Skip to content

ServerRequest: withoutAttribute Example

Terry L edited this page Jun 20, 2020 · 3 revisions
Clone this wiki locally

Shieldon\Psr7\ServerRequest

Extends Request.

withoutAttribute($name)

Return an instance that removes the specified derived request attribute.

  • param string name * The attribute name.
  • return static

Example:

$serverRequest = $serverRequest->withoutAttribute('ip_address');
$ip = $serverRequest->getAttribute('ip_address', 'undefined');

echo $ip
// Outputs: undefined