Home > Backend Development > PHP Tutorial > Several differences between require and include in php

Several differences between require and include in php

巴扎黑
Release: 2016-11-23 15:00:55
Original
1116 people have browsed it

If the php.ini configuration file is configured with URL fopen wrappers, then require can use the URL to include calls to remote files

require cannot contain control structures, and cannot contain return statements, which will cause a processing error.

require will be the first When executed this time, the contents of the included file will be replaced here, and include will be called again every time it is called. Therefore, require cannot include different files in the loop body.

require can access variables in the current scope

require occurs If an error occurs, the operation will stop immediately and an exception will be reported, and include will continue to execute after displaying the error message.

In the require in the conditional statement, regardless of whether the condition is established, the included content will be introduced, even if there is no chance of execution.


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template