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

Several differences between require and include in php

巴扎黑
巴扎黑Original
2016-11-23 15:00:551084browse

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.


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
Previous article:php email sendingNext article:php email sending