php - opendir, force listing hidden files (ftp)

2019-05-31 16:57发布

问题:

How to force listing hidden files with ftp connection in PHP script? Is there any context option for opendir?

Thanks

回答1:

"ftp_rawlist — Returns a detailed list of files in the given directory" (raw => ALL incl. hidden)

https://secure.php.net/manual/en/function.ftp-rawlist.php


There is one comment to the ftp_rawlist:

Get a listing of all files including hidden files except '.' or '..' use:

<?php
ftp_chdir($connid, $dir);
ftp_rawlist($connid, "-A");
?>

This had me dancing in circles for some time!