PHP traverses all files in XP folder

WBOY
Release: 2016-07-29 08:39:16
Original
949 people have browsed it

Copy the code The code is as follows:



//PHP traverses all files in the folder
$handle=opendir( 'C:\'); //I want to traverse the files on the C drive
echo "Directory handle: $handle
";
echo "File:
";
while ($file =readdir($handle)) {
$file=iconv('GB2312','UTF-8',$file);//Convert XP's gbk encoding to UTF8
echo "$file
" ; //Output file name
}
closedir($handle);
?>

The above introduces PHP to traverse all files in the XP folder, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!