../../image/benilogo.gifPHP4 について


PHP の Dir クラス ついて。

 PHPのマニュアル class dir 

dir -- ディレクトリ・クラス
説明
class dir { 

dir ( string directory )

string path

resource handle

string read ( void )

void rewind ( void )

void close ( void )



file_test/dir_01.php
$d = dir("./");
echo "Handle: ".$d->handle."\n";
echo "Path: ".$d->path."\n";
while (false !== ($entry = $d->read())) {
  if ($entry != "." and $entry != "..")
    echo $entry."\n";
}
$d->close();

  • <BR>は除いてある。
  • . と .. は 除く。

結果
Handle: Resource id #1
Path: ./
logout01.php
logdir
sjis.txt
logout01.php~
svr.php
dir_01.php
svr.php~
dir_01.php~

  • ./ としてやると今いる dir になる。

この通りに Directory のファイル名を取得出来る。  関数で実現しているのもある。



















目次に戻る

2005/06/04start ********* Last Update 2006/11/12 18:55 JST

(C) Y.Kondou,2005,2006 All Rights, Reserved.
その他、お気づきの点がありましたら連絡先はこちらから