What are the best practices for handling cross-origin frame loading in PHP scripts?

When loading content from a different origin in a frame within a PHP script, it is important to implement proper security measures to prevent cross-origin attacks. One way to handle this is by setting the appropriate headers to allow cross-origin requests only from specific origins. This can be done by using the "Access-Control-Allow-Origin" header in the PHP script.

<?php
header("Access-Control-Allow-Origin: https://allowed-origin.com");
// Other headers for additional security measures can be added here

// Your PHP script logic goes here
?>