Home >Backend Development >PHP Tutorial >PHP include any file or URL introduction_PHP tutorial
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.