web_response->setHeaders
Sets response headers from a collection.
Target
Signature
1web_response->setHeaders(headers::trait_forEach)Sets response headers from a collection.
web_response->setHeaders is called with member syntax on a receiver value. web_response->setHeaders belongs at the request or response boundary. Treat visitor input as untrusted, validate before use, and encode values before writing them into HTML.
Parameters
headers- Required value of type
trait_forEach. Supplyheaderspositionally unless the signature shows a keyword form.
Examples
Basic call
1web_response->setHeaders(array('X-Frame-Options'='DENY'))The example belongs near a request or response boundary; validate visitor input before trusting it.