★ wanayoo — archive 1999 http://www.php.net/manual/ja/function.is-dir.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to ファイルシステム
Quick Reference
English version of this pageGerman version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
ファイルシステム
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fscanf
* fseek
* fstat
* ftell
* ftruncate
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: is_dir
View the source code for this pageSearch the site



Previous page
 set_file_buffer
 Updated
Sat, 12 Aug 2000
is_executable 
Next page


is_dir

(PHP3 , PHP4 )

is_dir -- ファイルがディレクトリかどうかを調べる

説明

bool is_dir (string filename)

filenameが存在して、かつそれが ディレクトリであればtrueを返します。

この関数の結果はキャッシュされます。詳細は、 clearstatcache()を参照下さい。

is_file(), is_link() も参照下さい。


User Contributed Notes: is_dir


php@wastelan.com
11-Jun-1999 12:55
it appears like is_dir and is_file don't work
like you would expect.

is_dir("..") returns true
and yet is_dir("x") where x is a dir does not



me@seanbright.com
17-Jul-1999 07:03
Inconsistancy between is_dir and is_readable. is_readable does not
work on directories unless they are followed by a '/'. is_dir however
works even if there is no trailing slash. I am not sure if this is a UNIX
based issue or not, but remember to add that trailing slash. Hopefully
this will save someone else the time that I wasted ;)



php3-user@mindcontrol.org.NoSpam
16-Aug-1999 10:57
I think the first user's comments are based on being confused about the working directory for PHP3 scripts. The cwd is NOT necessarily the same as the location of the script. Use chdir() to set the CWD if you don't pass a full path to this functions (and others taking file names).


whit@asan.com
24-Aug-1999 12:48
Somewhere between 3.0.5 and 3.0.12 there was apparently a change in this function. 3.0.5 worked fine with "if (!is_dir($file))" constructions, where this followed an opendir(whatever) and $file=readdir() - without any further attention to path (must have been maintaining path info internally?). 3.0.12 apparently fails even with specifying the full path. This is on two Solaris systems, otherwise identical. is_file appears similarly dysfunctional.


whit@asan.com
24-Aug-1999 12:54
Correction, it does work now if you fully specify the path - but it used to not require it. So the documentation should note that a previous convenient functionality has been broken, and older scripts may need adjustment.


fnemec@sti.com.br
18-Feb-2000 03:02
I get a problem using is_dir() function.
If I do is_dir( "home/httpd/html/anydir" ) where anydir is a valid dir, sometimes I get a false result! If anyone knows what happens, please, help me! :)



duden@earthling.net
22-Feb-2000 06:41
I had problems with is_dir too.
They were like
is_dir("mydir/subdir") returns false
here my workaround:
chdir("mydir");
is_dir("subdir") works and returns true

hope it helps



lucian@hitel.net
15-Mar-2000 12:19
seems like is_dir, is_file and is_link work correctly _only_ for filenames that have absolute path. while
<pre>
is_dir("index.html");
</pre>
produces false result,
<pre>
is_dir("$document_root/index.html");
</pre>
produces correct result.



richards@herald.net
12-May-2000 12:22
fnemec: Your example seems to be missing an initial / . If that was cut-and-pasted from your code, that's probably your problem.


In all cases, you're probably better off passing fully pathed directories, though.



yorx@enter.vg
12-Jul-2000 05:26
It appears that is_dir does not work properly on win32, and returns false if the directory name has a trailing \. ex: is_dir('c:\\php') returns true while is_dir('c:\\php\\') returns false.


 About Notes


Previous page
 set_file_buffer
 Updated
Sat, 12 Aug 2000
is_executable 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.