What are the best practices for including PHP files in a web page using include() for dynamic content loading?

When including PHP files in a web page using include(), it is important to ensure that the file paths are correct and secure to prevent any security vulnerabilities. It is also recommended to use absolute paths instead of relative paths to avoid any issues with file inclusion. Additionally, it is good practice to sanitize user input before including any files to prevent any potential security risks.

<?php
include_once(__DIR__ . '/path/to/file.php');
?>