How To Require A File In PHP
Computing : Learning PHP We know that to include a file in PHP that is optional but not fatal we use: include ("myfile.php"); However there are occasions where we want the script to terminate if the file cannot be found. For instance if it contains functions that are needed for the page and script to run correctly we will want to REQUIRE that file not just include it. Thus we use: require ("myfile.php"); Now if the file cannot be found it will be a fatal error and script execution will terminate rather than with include where we just get a script error; depending on error_reporting levels.
Questions about learn PHP:
|
|