★ wanayoo — archive 1999 http://uk.php.net/manual/tr/function.filetype.phpNouvelle recherche | Portail wanayoo
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

flock> <filesize
Last updated: Fri, 04 Mar 2011

view this page in

filetype

(PHP 4, PHP 5)

filetypeDosya türünü döndürür

Açıklama

string filetype ( string $dosyaismi )

Belirtilen dosyanın türünü döndürür.

Değiştirgeler

dosyaismi

Dosya yolu.

Dönen Değerler

Dosyanın türünü döndürür. Olası değerler: fifo, char, dir, block, link, file, socket ve unknown.

Bir hata oluşursa FALSE döner. eğer stat çağrısı başarısız olur veya dosya türü anlaşılamazsa ayrıca, bir E_NOTICE iletisi çıktılanır.

Örnekler

Örnek 1 - filetype() örneği

<?php

echo filetype('/etc/passwd');  // file
echo filetype('/etc/');        // dir

?>

Notlar

Bilginize: Bu işlevin sonuçları önbelleğe kaydedilir. Daha ayrıntılı bilgi edinmek için clearstatcache() işlevine bakınız.

İpucu

PHP 5.0.0 sürümünden itibaren bu işlev bazı URL sarmalayıcıları ile kullanılabilmektedir. stat() ailesini destekleyen sarmalayıcıların listesini Supported Protocols and Wrappers başlığı altında bulabilirsiniz.

Ayrıca Bakınız

  • is_dir() - Bir dosyanın bir dizin olup olmadığını söyler
  • is_file() - Bir dosyanın sıradan bir dosya olup olmadığını söyler
  • is_link() - Bir dosyanın sembolik bağ olup olmadığını söyler
  • file_exists() - Bir dosya veya dizinin mevcut olup olmadığına bakar
  • stat() - Bir dosya hakkında bilgi döndürür
  • mime_content_type() - Detect MIME Content-type for a file (deprecated)



flock> <filesize
Last updated: Fri, 04 Mar 2011
 
add a note add a note User Contributed Notes filetype
adlerweb 07-Oct-2010 08:09
filetype() does not work for files >=2GB on x86 Linux. You can use stat as a workarround:

$type=trim(`stat -c%F $file`);

Note that stat returns diffenerent strings ("regular file","directory",...)
7r6ivyeo at mail dot com 22-Nov-2008 01:29
I use the CLI version of PHP on Windows Vista.  Here's how to determine if a file is marked "hidden" by NTFS:

<?php
function is_hidden_file($fn) {

   
$attr = trim(exec('FOR %A IN ("'.$fn.'") DO @ECHO %~aA'));

    if(
$attr[3] === 'h')
        return
true;

    return
false;
}
?>

Changing <?php if($attr[3] === 'h') ?> to <?php if($attr[4] === 's') ?> will check for system files.

This should work on any Windows OS that provides DOS shell commands.
ruach at chpc dot utah dot edu 11-Mar-2004 01: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

 
show source | credits | stats | sitemap | contact | advertising | mirror sites