require-once in php, phprequire-once
require_once statement and require statement are exactly the same, the only difference is PHP will check whether the file has already been included, and if so, it will not be included again.
See the documentation of include_once to understand the meaning of _once and understand the difference from without _once.
How to use
define('__ROOT__',dirname(dirname(__FILE__))));
require_once(__ROOT__.'/config.php');
?>
Method 2:
2Example: Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
require_once('sys/config.php');
require_once('header.php');
?>
系统平台
一个简单的留言板系统平台
一个简单的留言板。
require_once('footer.php');
?>
|
1
2
3
4
5
6
7
8
9
1011
12
13
14
15
16
17
18
19
|
<🎜>require_once('sys/config.php');<🎜>
<🎜>require_once('header.php');<🎜>
<🎜>?>
System Platform
A simple message board system platform
A simple message board.
<🎜>require_once('footer.php');<🎜>
<🎜>?>
|
http://www.bkjia.com/PHPjc/1048776.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1048776.htmlTechArticleThe require-once in php, phprequire-once require_once statement and require statement are exactly the same, the only difference is that PHP will check Whether the file has already been included, if so, it will not be included again...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn