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, 20 Nov 2009

view this page in

filetype

(PHP 4, PHP 5)

filetypePobiera typ pliku

Opis

string filetype ( string $nazwa_pliku )

Zwraca typ pliku. Możliwe wartości to fifo, char, dir, block, link, file i unknown.

Zwraca FALSE jeśli wystąpił błąd. filetype() również utworzy wiadomość E_NOTICE jeśli wywołanie stat się nie powiedzie lub gdy plik ma tym nieznany (unknown).

Informacja: Wyniki działania tej funkcji są buforowane. Zobacz opis funkcji clearstatcache() aby uzyskać więcej informacji.

Wskazówka

Od PHP 5.0.0 ta funkcja może być użyta także z niektórymi nakładkami URL. Zobacz List of Supported Protocols/Wrappers aby uzyskać listę nakładek, które obsługują funkcjonalność z rodziny stat().

Przykład #1 filetype() przykład

<?php

echo filetype('/etc/passwd');  // plik
echo filetype('/etc/');        // katalog

?>

Patrz także: is_dir(), is_file(), is_link(), file_exists(), stat() i mime_content_type().



add a note add a note User Contributed Notes
filetype
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

flock> <filesize
Last updated: Fri, 20 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites