资 源 简 介
I need to include a files in all of your site’s pages? Normally, you’d use require() or include(). But do I really want to manually past the include code in every page?
This may be at the start of page or end of page.
There’s the little known PHP directive auto_prepend_file and auto_append_file. What are PHP directives? They’re essential global PHP settings that are defined in you php.ini file. There is surprisingly little information about these methods out there, but luckily they aren’t too difficult to work with.
In the php.ini file, we can implement like this,
; Automatically add files before or after any PHP document.
auto_prepend_file = D:/wamp/www/includefileatstart.php
auto_append_file = D:/wamp/www/includefileatend.php
For Linux system it is something like this
/home/username/public_html/includefile.php
For me this will not work on Wamp… ;)
So I have to find another way, … so we did with the help of .htaccess