Home >Backend Development >PHP Tutorial >How to prevent php from directly entering the address from the browser to access .php files, _PHP Tutorial
The example in this article describes how PHP prohibits accessing .php files by directly entering the address from the browser. Share it with everyone for your reference. The specific implementation method is as follows:
Generally speaking, we do not want users to directly enter the address to access some important files, so we need to make some settings for this. The following summarizes some PHP methods to prohibit accessing .PHP files directly from entering the address in the browser, which are very practical.
For example, I don’t want others to access the file http://www.bkjia.com/xx.php by entering the address directly from the browser.
But if you cannot access http://www.bkjia.com/xx.php from any website, you will not be able to access it even if you establish a connection locally and jump to another address.
1. Just write the following code in the header of the xx.php file
3. Get this variable in config.php
I hope this article will be helpful to everyone’s PHP programming design.