Is it possible to make a Top Level Variable in PHP? Like Defining in .htaccess
or httpd.conf
? To be included in each .php
file?
I would love to define BasePaths and some other variables there if possible. I am currently making some init.php
and including 'em on top if each file.
As your working with a multi entry point application, if you want to avoid including your configuration file, you can use the php's autoprepend functionality. This will automatically include a file for you without the need to do a <?php require('init.php'); ?>
in each of you entry points.
And you can find a good advice here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With