循环读取目录中的文件
程序员文章站
2022-05-24 20:58:28
...
php代码
header("Content-type:text/html;charset=utf-8;"); set_time_limit(0); $dir_ = dirname(__FILE__)."/tmp/"; $dest = dirname(__FILE__)."/dir/"; $dread = opendir($dir_); while(false != ($df = readdir($dread))) { if($df != "." && $df != ".."){ if(is_dir($dir_.$df)){ echo "======".$df."======"." "; echo dirs($dir_.$df."/")." "; } } } function dirs($d) { global $dest; $od = opendir($d); while(false != ($ddf = readdir($od))) { if($ddf != "." && $ddf != ".."){ copy($d.$ddf,$dest.$ddf); } } }
上一篇: SQL 关于pivot
下一篇: 数据库外连接和内连接详解_MySQL