- <?php
- // 특정 파일 포함 키워드
- /*
- include_f.php파일내용
- <?php
- $include_f = "특정파일의 require_f.php 포함, 파일없으면 경고메세지";
- ?>
- require_f.php파일내용
- <?php
- $require_f = "특정파일의 require_f.php 포함, 파일없으면 에러메세지";
- ?>
- */
- include "include_f.php";
- include_once "include_f.php";
- // include_once 파일이 포함되어 있다면 한번 이외에 포함시키지 않습니다.(중복방지)
- echo $include_f."<br>\n";
- // 특정파일의 include_f.php포함, 파일없으면 에러메세지
- require "require_f.php";
- require_once "require_f.php";
- // require_once 파일이 포함되어 있다면 한번 이외에 포함시키지 않습니다.(중복방지)
- echo $require_f."<br>\n";
- // 특정파일의 require_f.php포함, 파일없으면 경고메세지
- ?>
--------------------------------------------------------------------------------------------
특정 파일 포함 키워드 include, require 사용과 차이
14.15.20.21. 라인
include, require 사용은 특정 파일을 포함시키는 키워드 입니다.
include, require 차이점은 포함시킨 파일이 없을시
include는 에러메세지가 출력되고
require 는 경고메세지가 출력됩니다.
또한 include_once 나 require_once 는
해당 파일이 포함이 되어 있다면
그 한번 이외에 포함시키지 않습니다.
'php5 > 파일관련함수' 카테고리의 다른 글
파일 경로 반환 - string dirname ( string $path ) (0) | 2014.01.09 |
---|---|
파일의 현재 작업 디렉토리 반환 - string getcwd ( void ) (0) | 2014.01.09 |
파일 경로에서 파일명만 반환 - string basename ( string $path ) (0) | 2014.01.08 |
zlib(.gz) 과 bzip2(.bz2) 압축 파일 기본 문법 (0) | 2014.01.08 |
파일 기본 문법 (0) | 2014.01.08 |