Home  >  Article  >  Backend Development  >  Methods in PHP to prevent direct access or viewing or downloading of the config.php file_PHP Tutorial

Methods in PHP to prevent direct access or viewing or downloading of the config.php file_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:17:47679browse

Or is it that PHP's design itself avoids directly viewing the file content? From a security perspective, what protection measures should be taken for this system-level file?
Netizen’s perfect answer
After research, we found the following common methods:

1 Define an identification variable in the program

Copy code The code is as follows:

define('IN_SYS', TRUE);


2 Get this variable in config.php
Copy code The code is as follows:

if(!defined('IN_SYS')) {
exit('Access Forbidden' );
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325674.htmlTechArticleOr, the design of PHP itself avoids directly viewing the file content? From a security perspective, what protection measures should be taken for this system-level file? Perfect answers from netizens After research...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn