본문으로 바로가기

php 디렉토리 존재 확인 + 생성

category 카테고리 없음 2020. 9. 25. 11:16
$imgdir = './images/goods/';

//디렉토리 확인
if(!file_exists($imgdir)){
  echo "디렉토리 생성";
  @mkdir($imgdir, 0777, true);
}

https://www.delftstack.com/ko/howto/php/how-to-create-a-folder-if-it-does-not-exist-in-php/