PHP include Arbitrary File or URL Introduction

Source: Internet
Author: User

In practice, write a simple PHP file and include a js file. After the file is executed, no error or warning information is reported. At the same time, the content of the file containing js is printed. Therefore, it is concluded that the include object can be of any type.

Now let's look back at the include official document, which includes the following: "When a file is contained, the syntax parser disconnects from the PHP mode at the beginning of the target file and enters the HTML mode, restore to the end of the file. For this reason, any code in the target file that needs to be executed as PHP code must be included in the valid PHP start and end tags ." Note that the "HTML mode, PHP code must be included in a valid PHP tag" is mentioned in this document, and you can carefully understand its meaning. In fact, it implicitly illustrates that include can be any type of file.

In addition, after 4.3.0, The include target file can also be a url, provided that allow_url_include must be set to on in the configuration.

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.