Reputation: 198
For example, we have a directory with php files.
And in this folder we have a file class.logger.inc
Before executing files from dir, we need to 'prepend' or include automatically this file, to call functions from class.logger from other php files in directory.
How to realize it not touching files.
Looked at the auto_prepend_file
but seems it include if script terminate with exit()
Upvotes: 0
Views: 254
Reputation: 13700
I would suggest using URL rewriting,
in the .htaccess file:
RewriteRule ^originaldirectory/(.*)$ /wrapper.php?f=$1 [R=301,NC,L]
and the content of the wrapper file should be
<?php
include 'prepended_content.php';
include 'originaldirectory/'.$_GET['f'];
include 'appended_content.php';
?>
Upvotes: 1