02-顯示特定路徑的檔案 和 文件夾

<?php

function dua_get_dirs($path)
{
    $dir_paths= []; ;
    $dirs = array_filter(glob($path . "*",GLOB_MARK), 'is_dir');
    foreach ($dirs as $filename)
    {
        $dir_paths[] = $filename;
    }
    return $dir_paths;
}
function dua_get_files($path)
{
    $dir_paths= []; ;
    $files = array_filter(glob($path . "*",GLOB_MARK), 'is_file');
    foreach ($files as $filename)
    {
        $dir_paths[] = $filename;
    }
    return $dir_paths;
}
$t1=dua_get_dirs("/Applications/XAMPP/xamppfiles/htdocs/ETC/測試文件/");
print_r($t1);
$t1=dua_get_files("/Applications/XAMPP/xamppfiles/htdocs/ETC/測試文件/");
print_r($t1);

PHP
01 StringCH02 ArrayCH03 檔案技術文章CodeIgniter 技術文章youtube api 技術文章