它们之间有什么区别吗?使用它们是一个偏好的问题?使用一个优于另一个产生任何优势吗?哪个更安全?
我知道PHP需要的基本用法,需要一次,包含和包含一次.但我很困惑何时应该使用它们.
示例:我有3个文件,例如:settings.php,database.php和index.php.
在database.php文件中,我写道:
require_once 'settings.php';
Run Code Online (Sandbox Code Playgroud)
然后在index.php中,我写道:
require_once 'settings.php';
require_once 'database.php';
Run Code Online (Sandbox Code Playgroud)
所以我加载settings.php两次,这样可以吗?任何提示使用这些功能?