note 119541 added to function.is-dir
| From: | citizenmarco at gmail dot com | Date: | Sun, 03 Jul 2016 05:25:30 +0000 |
| Subject: | note 119541 added to function.is-dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205868@lists.php.net to get a copy of this message | ||
Note that there quite a few articles on the net that imply that commands like is_dir, opendir,
readdir cannot read paths with spaces.
On a linux box, THAT is not an issue.
Sample test code;
$dir = "Images/Soma ALbum Name with spaces";
echo $dir."<br/>";
// Open a directory, and read its contents
if (is_dir($dir)){
echo $dir."<br/>"; // will not appear if above fails
if ($dh = opendir($dir)){
echo $dir."<br/>"; // will not appear if above fails
while (($file = readdir($dh)) !== false){
echo "filename:" . $file . "<br>";
echo $dir."<br/>"; // will not appear if above fails
}
closedir($dh);
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 175.139.48.69
----
Manual Page -- http://php.net/manual/en/function.is-dir.php
Edit -- https://master.php.net/note/edit/119541
Del: integrated -- https://master.php.net/note/delete/119541/integrated
Del: useless -- https://master.php.net/note/delete/119541/useless
Del: bad code -- https://master.php.net/note/delete/119541/bad+code
Del: spam -- https://master.php.net/note/delete/119541/spam
Del: non-english -- https://master.php.net/note/delete/119541/non-english
Del: in docs -- https://master.php.net/note/delete/119541/in+docs
Del: other reasons-- https://master.php.net/note/delete/119541
Reject -- https://master.php.net/note/reject/119541
Search -- https://master.php.net/manage/user-notes.php