PHP require_once

 The usage of PHP require_once is almost the same as simple require , but the difference is that require_once can only be included in the main PHP file once, and will not be included repeatedly, so if each external file can only appear once, use require_once Right!


When the program is in a situation where the operating system is not very strict on capitalization, such as the Windows series, there may be a little difference in include or require files. This difference mainly occurs in PHP4. Please refer to the following example.
<?php
require_once "abc.php"; 
require_once "ABC.php";
?>
If it is a Linux operating system, after require_once includes abc.php for the first time, it will not include it for the second time. In a Windows operating system, the second action will be executed, which is to include abc.php repeatedly file.

Post a Comment

0 Comments