Forum und email

chdir

(PHP 4, PHP 5)

chdir — 디렉토리를 변경합니다.

설명

bool chdir ( string $directory )

PHP의 현재 디렉토리를 directory 로 변경합니다. 성공할 경우 TRUE를, 실패할 경우 FALSE를 반환합니다.

Example#1 chdir() 예제

<?php
    
// 현재 디렉토리
echo getcwd() . "\n";
    
chdir('public_html');
    
// 현재 디렉토리
echo getcwd() . "\n";
    
?>

출력 예는:

/home/vincent
/home/vincent/public_html

Note: 안전 모드를 활성화했을 경우, PHP는 작업하려는 디렉토리가 실행중인 스크립트와 같은 UID(owner)를 가지고 있는지 확인합니다.

참고: getcwd().