Home > php教程 > php手册 > body text

php中的require-once,phprequire-once

WBOY
Release: 2016-06-13 08:55:39
Original
1190 people have browsed it

php中的require-once,phprequire-once

require_once语句和require语句完全相同,唯一区别是 PHP 会检查该文件是否已经被包含过,如果是则不会再次包含。

参见include_once的文档来理解_once的含义,并理解与没有_once时候有什么不同。

使用方法

  define('__ROOT__',dirname(dirname(__FILE__)));
  require_once(__ROOT__.'/config.php');
  ?>
  方法二:

2例如:编辑

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');

?>

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template