Home  >  Article  >  Backend Development  >  What is the function of require in php

What is the function of require in php

王林
王林Original
2020-06-30 10:17:574341browse

The function of the require statement in php is to insert useful code written in other files into the execution flow. When the require statement introduces a file, if an error is encountered, a prompt will be given and the following code will stop running. The syntax of the require statement: [require 'filename'].

What is the function of require in php

Function: The

require statement is used to insert useful code written in other files into the execution flow.

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

Syntax:

require 'filename';

Example:

test-require.php

<?php
require &#39;test-nothing.php&#39;;
echo &#39;abc&#39;;
?>

If you want to know more related questions, please visit php Chinese website.

The above is the detailed content of What is the function of require 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
Previous article:what is php destructorNext article:what is php destructor