PHP: Get all files and folders from a directory (folder) PHP는 : 모든 파일 및 폴더를 디렉토리 (폴더)에서 떨어져
Posted on 16. 16 게시됨. Jun, 2009 by Dragos in Coding , PHP 6 월, 2009 코딩, PHP로의 드라 고스에 의해
To get all files and folders from a directory (folder) I found scandir to be the perfect solution. 모든 파일 및 폴더를 디렉토리 난 완벽한 솔루션을 찾을 수 scandir (폴더)에서 얻으려면.
scandir scans a directory and returns an array containing all files and directories under the parent directory we're looking in. scandir 디렉토리를 스캔하고 배열의 상위 디렉토리 아래에 우리가 찾고있는 응답의 모든 파일과 디렉토리를 포함하는
The code below will try to remove a directory, if the element is a directory or delete a file, if respectively the element is a file. 만약 요소가 디렉토리 또는 파일을 삭제할 경우, 각각 요소 아래의 코드 디렉토리를 제거하려고한다 파일입니다.
$lookin='./home/folder'; $ = 찾고 '. / 홈 / 폴더'; $elements=scandir($lookin); $ 요소 = scandir ($ 봐라); foreach($elements as $singleEl) { $ singleEl로 foreach는 ($ 요소) ( if(is_dir($lookin.'/'.$singleEl)) rmdir($lookin.'/'.$singleEl); (is_dir ($ 만약 찾는 .'/'.$ singleEl)) rmdir ($ 찾는 .'/'.$ singleEl); else 그 밖의 unlink($lookin.'/'.$singleEl); 연결을 해제 (.'/'.$ $ 찾는 singleEl); } )
Related posts: 관련 게시물 :
- Apache & ModRewrite: How to easily deny access to a folder with htaccess 아파치 & ModRewrite : 어떻게 쉽게 폴더에 대한 액세스를 거부 htaccess를
- JavaScript: How to get the index (position within a group) of an object with jQuery? 자바 스크립트 : 어떻게 jQuery와 개체의 (위치를 그룹 내에서) 인덱스를 얻을가?
- JavaScript: Where do I Find All Properties for All HTML Elements ? 자바 스크립트 : 어디에서 모든 HTML 요소에 대한 모든 속성을 찾을 수 있습니까?
- PHP: How to get creation time of file with PHP on Linux machines PHP는 : 어떻게 리눅스 머신에서 PHP와 파일의 생성 시간을
- Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script WordPress의 : Wordpress에 대한 최고의 SEO iTranslator, 완전 자동화된 플러그인을 스크립트에서 무료로 트래픽을 얻을












































