v2.5.2
Giriş yap

PHP file_exists() Fonksiyonu

PHP 4PHP 5PHP 7

Dosya ya da dizinin var olup olmadığını kontrol eder.

Yapısı (Syntax)file_exists ( string $filename ) : bool

Parametreler

  • $filename string
    Kontrol edilecek dosya ya da dizinin yolu

Dönen Değer

boolean - Kontrol edilen dosya/dizin var ise TRUE yok ise FALSE değeri döner.

Örnekler

Bir dosyanın var olup olmadığını kontrol edelim.

<?php

$path = 'cache/test.json';

if ( file_exists($path) ){
    echo 'Dosya mevcut';
} else {
    echo 'Dosya bulunamadı';
}

?>

Bir dizinin var olup olmadığını kontrol edelim.

<?php

$path = 'upload/slider';

if ( file_exists($path) ){
    echo 'Dosya mevcut';
} else {
    echo 'Dosya bulunamadı';
}

?>

tayfunerbilen
1791 gün önce eklendi - 3047 kez görüntülendi.
Github'da Düzenle
Önceki trim() Sonraki is_string()