How can access to PHP files that are only meant for inclusion be restricted to prevent direct access?

To restrict access to PHP files that are only meant for inclusion and prevent direct access, you can use the following code snippet. By checking if a constant is defined in the included files, you can prevent direct access to them.

<?php
define('INCLUDED', true);

// Your included PHP file code goes here
```

In your included PHP files, add the following code at the beginning:

```php
<?php
if (!defined('INCLUDED')) {
    header('HTTP/1.0 403 Forbidden');
    exit('Direct access not allowed');
}