& Nbsp; in many programs, php (as the mainstream development language) files are used as templates, in this way, php (as the mainstream development language) can be parsed directly in the template, but the disadvantage is that you can directly access this file to display all the code, this has brought great convenience to those who steal templates. SyntaxHighlighter uses php (as the mainstream development language) files in many programs as templates, in this way, php (as the mainstream development language) can be parsed directly in the template, but the disadvantage is that you can directly access this file to display all the code, this makes template stealing extremely convenient.
In fact, it is very easy to prevent php (as the mainstream development language) template files from being directly accessed. you only need to add the following code in the file header:
The following is a code snippet: $ Thisfilename = "templates/geek/index. php (as the mainstream development language)"; // The relative path to which the template file is directly accessed If (strtolower (substr ($ _ SERVER ["php (as the mainstream development language) _ SELF"],-Len ($ thisfilename) ==$ thisfilename) exit; ?> |
The code looks very simple. The principle of the two statements is also very simple:
Determine the access path of the client. if the direct path of the template file is included, exit the execution.
Generally, we place all template files under a special directory, and this path does not need to be accessed directly.
Hope to help friends.
Never-ending technical exchanges