Home > Article > Backend Development > What is the usage of php require
php The require statement means including and running the specified file, and require will generate a fatal error "E_COMPILE_ERROR" and stop the script. Its statement usage is "require( dirname(__FILE__) . '/wp-load.php' ) ;".
Recommended: "PHP Tutorial"
How to use php require
How to use the require() statement in php
The require() statement includes and runs the specified file.
require() statement includes and runs the specified file.
require() and include() are identical in every respect except how they handle failure.
require generates a fatal error (E_COMPILE_ERROR) and stops the script
include generates only a warning (E_WARNING), and the script continues
include() generates a warning while require( ) results in a fatal error.
In other words, if you want to stop processing the page when a file is missing, don't hesitate to
use require(). This is not the case with include() and the script will continue to run. Also make sure the appropriate include_path is set.
require( dirname(__FILE__) . '/wp-load.php' );
The above is the detailed content of What is the usage of php require. For more information, please follow other related articles on the PHP Chinese website!