// set the response content type to JSON $response->set_header('Content-Type', 'application/json');
// set the response to be cached for 1 hour $response->set_header('Cache-Control', 'public, max-age=3600');
// allow requests from any source $response->set_header('Access-Control-Allow-Origin', '*'); // allow only GET requests $response->set_header('Access-Control-Allow-Methods', 'GET');In this example, we're setting CORS headers to allow cross-origin requests from any source and to only allow HTTP GET requests. Package Library: Native PHP Overall, the `set_header()` method is a powerful tool for controlling the behavior of our server responses. Its versatility allows us to customize our server's output for a wide variety of use cases, making it an essential part of any PHP developer's toolkit.