set_include_path
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
set_include_path — include_path 구성 옵션을 설정합니다.
설명
set_include_path(string $include_path
): string|false
스크립트 기간 동안 include_path 구성 옵션을 설정합니다.
매개변수
include_path
- include_path의 새 값
value
으로 빈 문자열을 전달하면 어설션 콜백이 재설정됩니다.
반환 값
성공하면 이전 include_path를 반환하고 실패하면 false
를 반환합니다.
Examples
예제 #1 set_include_path() 예제
<?php
set_include_path('/usr/lib/pear');
// Or using ini_set()
ini_set('include_path', '/usr/lib/pear');
?>
예제 #2 include path에 추가
PATH_SEPARATOR
상수를 사용하면 운영 체제에 관계없이 포함 경로를 확장할 수 있습니다.
이 예에서는 기존 include_path
의 끝에 /usr/lib/pear를 추가합니다.
<?php
$path = '/usr/lib/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
?>
기타
- ini_set() - 구성 옵션의 값을 설정합니다.
- get_include_path() - 현재 include_path 구성 옵션을 가져옵니다.
- restore_include_path() - include_path 구성 옵션의 값을 복원합니다.
- include - include