현재 디렉토리와 디렉토리의 변경
getcwd
chdir
<?php
echo getcwd().'<br />'; #현재 디렉토리 확인
chdir('../'); #디렉토리 변경
echo getcwd().'<br />';
?>
디렉토리의 탐색
scandir
<?php
$dir = './';
$files1 = scandir($dir); #현재 디렉토리 탐색
$files2 = scandir($dir, 1); #디렉토리 탐색결과 거꾸로 정렬
print_r($files1);
print_r($files2);
?>
디렉토리의 생성
mkdir(디렉토리이름, 권한설정, 첫번째인자로 주어진 경로가 없으면 이 경로를 만들어준다는 의미)
<?php
mkdir("1/2/3/4", 0700, true);
?>
'PHP' 카테고리의 다른 글
[PHP] 이미지 다루기 (0) | 2022.06.16 |
---|---|
[PHP] 파일 업로드 (0) | 2022.06.16 |
[PHP] 파일 제어 (0) | 2022.06.15 |
[PHP] include와 namespace (0) | 2022.06.14 |
[PHP] 배열 (0) | 2022.06.14 |
댓글