ThinkPHP protection template materials

Source: Internet
Author: User
ThinkPHP protects the template file core prompt: because the template file may leak the field information of the data table, there are two ways to protect your template file from being accessed: The first way is to configure. the htaccess file and ThinkPHP protect the Template File. for the Apache server, save the following code in the template directory of the project (Tpl by default) and save it. htaccess. in this way, the entire project directory cannot be accessed directly, because the ThinkPHP template protects the template file.
Core tip: because the fields in the data table may be leaked in the template file, there are two ways to protect your template file from being accessed: The first method is configuration. the htaccess file and ThinkPHP protect the Template File. for the Apache server, save the following code in the template directory of the project (Tpl by default) and save it. htaccess. in this way, the entire project directory cannot be accessed directly, because the field information of the data table may be leaked in the template file. There are two ways to protect your template file from being accessed:

The first method is to configure the. htaccess file for the Apache server.

Save the following code in the template directory of the project (Tpl by default) as. htaccess.


Order Allow, Deny
Deny from all


If your template file suffix is not html, you can change *. html to the suffix of your template file.

The second method is for independent servers and is not suitable for VM users.

Deploy the project directory outside the WEB Directory of the website according to the website security deployment solution we mentioned earlier. in this way, the entire project directory cannot be accessed directly, and the template file is also protected.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.