Home > Article > Backend Development > What is the function of require in php
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'].
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 'test-nothing.php'; echo 'abc'; ?>
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!