php函数将目录中的文件名列表拉入php数组

php函数将目录中的文件名列表拉入php数组,php,xml,bash,plist,info.plist,Php,Xml,Bash,Plist,Info.plist,如何从目录中提取文件名列表并将其存储到php中的数组中 如何从xml文档中获取值 如何提取目录中文件的路径/名称并将其存储到数组中 又名: 从名为info.plist的xml文件中获取捆绑包id并将其存储到数组中的某种方法。类似于json_decode() 使用获取目录中的文件/目录列表。请一次提出一个问题,除非它们非常相关。在这种情况下,解析XML和获取文件列表是不相关的。对不起!有很多事情要弄清楚。我没有试图压倒任何人。我尝试使用glob(),它给了我迄今为止发现的两个输出。1.输出:数组(

如何从目录中提取文件名列表并将其存储到php中的数组中

如何从xml文档中获取值

如何提取目录中文件的路径/名称并将其存储到数组中

又名:

从名为info.plist的xml文件中获取捆绑包id并将其存储到数组中的某种方法。类似于json_decode()


使用获取目录中的文件/目录列表。

请一次提出一个问题,除非它们非常相关。在这种情况下,解析XML和获取文件列表是不相关的。对不起!有很多事情要弄清楚。我没有试图压倒任何人。我尝试使用glob(),它给了我迄今为止发现的两个输出。1.输出:数组();//空数组2。输出:不存在这样的文件或目录//则path@AlexCory您使用什么作为函数的参数?
$proj_dir = "~/directory/path/to/project_files;"; // same as output from {query}

$data_dir = "~/directory/path/to/data_files;";

$query = "{query}"; // returns path to project being accessed. current output of $proj_dir
$bundle_id_from_proj = function_to_pull_bundleid_out_of_the_file("bundle_id", '"{query}" . "/info.plist"');

$directories = array();

$cmd1 = # some way to get names of files in data/ directory via bash script
exec("$cmd");

$directories = # some way to pull values out of that array and store in php array

foreach ($directories as $directory) {
     // if title of a directory in data directories = bundleID of project
     if ( $directories['title'] === $bundle_id_from_proj )
     {
          $cmd2 = 'open -a Finder "$directory"';
          exec("$cmd2");
     }
     else
     {
          $cmd3 = 'Sorry! Can\'t find it';
          echo $cmd3;
     }

}