How can PHP output be used to manipulate browser behavior without directly interacting with the browser?

PHP output can be used to manipulate browser behavior without directly interacting with the browser by sending specific headers in the HTTP response. For example, you can set headers to force a file download, redirect the browser to a different page, or prevent caching of a page. By using PHP's header() function to send these headers, you can control how the browser interprets and displays the content.

<?php
// Force download of a file named example.txt
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.txt"');
readfile('example.txt');
exit;
?>