Home >Backend Development >PHP Tutorial >PHP include any file or URL introduction_PHP tutorial

PHP include any file or URL introduction_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:31:35937browse

Practice the truth and write a simple PHP file to include a js file. After execution, there is no error or warning message, and you can see that the contents of the included js file are printed out. Therefore, it is concluded that the include target file can be of any type.

Now look back at the official documentation for include, which says: "When a file is included, the syntax parser leaves PHP mode at the beginning of the target file and enters HTML mode, and resumes at the end of the file. Because of this Because any code in the object file that needs to be executed as PHP code must be included in valid PHP start and end tags." Note that in HTML mode, PHP code must be included in valid PHP tags." , understand its meaning carefully, it actually implicitly states that include can be any type of file.

In addition, after 4.3.0, the include target file can also be a URL. Of course, the premise is that allow_url_include needs to be set to on in the configuration.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/762614.htmlTechArticlePractice the truth, write a simple PHP file to include a js file, and there will be no error or warning message after execution. At the same time, See that the contents of the file containing js are printed. Hence...
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