thinkphp security file directory

In order to avoid some of the server opens the directory browsing permissions can be entered directly in the browser URL address to view the directory, the system opens the default file directory security mechanisms will be generated automatically generated when a blank directory index.htmlfile, of course, the name of the security file can be set , for example, you want to give the security file is defined as default.htmlcan be added at the entrance of the file:

Marble platform manufacturers

  1. define('DIR_SECURE_FILENAME', 'default.html');
  2. define('APP_PATH','./Application/');
  3. require './ThinkPHP/ThinkPHP.php';

You can also support multiple security file is written, for example, you want to simultaneously write two files index.html and index.htm to meet different server deployment environment, it can be defined as:

  1. define('DIR_SECURE_FILENAME', 'index.html,index.htm');

The default security file just write a blank string, if need be written other content, you can be specified by DIR_SECURE_CONTENT parameters, such as:

  1. define('DIR_SECURE_CONTENT', 'deny Access!');

Note: The directory security file is generated only when the first generation module directory. If it is 3.2.1 or later, you can call code generation, such as:

  1. // dirs变量是要生成安全文件的目录数组
  2. \Think\Build::buildDirSecure($dirs);
 

Guess you like

Origin www.cnblogs.com/furuihua/p/11842588.html