Home >Backend Development >PHP Tutorial >Things to note when introducing php file require

Things to note when introducing php file require

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 08:52:021215browse

If the PHP statement is placed in an HTML file, it will not be processed. However, if you load this HTML file using the require() statement, any PHP commands within the file will be called. Therefore, include files can be named with any extension, but following a convention, such as naming the extension .inc or .php is a good idea.

If you do not use the .php extension to name it, you need to place the file to be imported outside the document tree to prevent users from viewing the source code in text form after loading it directly in the browser.

If the extension is .php but only contains part of the page or script, an error may occur.

Note: No matter which extension is used, the PHP code in the file to be introduced must be placed between PHP tags. Otherwise, the code will be regarded as text or HTML script and therefore will not be executed.

The above introduces the precautions for introducing the PHP file require, including the content of require and PHP files. I hope it will be helpful to friends who are interested in PHP tutorials.

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