Home  >  Article  >  Backend Development  >  How to use the require() statement in php

How to use the require() statement in php

王林
王林Original
2020-08-29 13:58:203848browse

How to use the require() statement in php: [require("myfile.php")]. The require() statement is used to include and run the specified file. This statement is usually placed at the front of the PHP script program. The PHP program will first read the file introduced by the require() statement before execution.

How to use the require() statement in php

Function: The

require() statement is used to include and run the specified file.

(Recommended tutorial: php video tutorial)

Usage method such as:

require("myfile.php")

This statement is usually placed at the front of the PHP script program. Before the PHP program is executed, it will first read the file introduced by the require() statement, making it a part of the PHP script file.

(Related tutorials recommended: php training)

require() statement is a language structure, not a real function. It can be like other language structures in PHP, such as echo() can use echo("ab") form, or echo "abc" form to output the string abc. The require() and include() statements can also add parameters directly without parentheses.

Note: When require imports a file, if an error is encountered, a prompt will be given and the code below will stop running.

The above is the detailed content of How to use the require() statement in php. For more information, please follow other related articles on the PHP Chinese website!

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