The only difference between the two is that require
and its sister require_once
throw a fatal error if the file is not found, whereas include
and include_once
only show a warning and continue to load the rest of the page. If you don't want PHP to attempt to load the rest of your page without the database info (which I would assume), then use require_once
. You don't need to include the file more than once, so there is no need to use the regular require
function.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…