PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

flock> <filesize
Last updated: Fri, 03 Oct 2008

view this page in

filetype

(PHP 4, PHP 5)

filetypeファイルタイプを取得する

説明

string filetype ( string $filename )

指定したファイルのタイプを返します。

パラメータ

filename

ファイルへのパス。

返り値

ファイルのタイプを返します。返される値は fifo、char、dir、 block、link、file、socket および unknown のいずれかです。

エラーが発生すると FALSE を返します。 また filetype() は stat コールに失敗したり、 未知のファイルタイプであったりした場合に E_NOTICE メッセージを発行します。

例1 filetype() の例

<?php

echo filetype('/etc/passwd');  // ファイル
echo filetype('/etc/');        // ディレクトリ

?>

注意

注意: この関数の結果は キャッシュされます。詳細は、clearstatcache() を参照してください。

ヒント

PHP 5.0.0 以降、この関数は、 何らかの URL ラッパーと組合せて使用することができます。 どのラッパーが stat() ファミリーをサポートしているか のリストについては、サポートされるプロトコル/ラッパー を参照してください。



add a note add a note User Contributed Notes
filetype
ruach at chpc dot utah dot edu
11-Mar-2004 02:11
There are 7 values that can be returned. Here is a list of them and what each one means

block: block special device

char: character special device

dir: directory

fifo: FIFO (named pipe)

file: regular file

link: symbolic link

unknown: unknown file type

flock> <filesize
Last updated: Fri, 03 Oct 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites