Piwik\Filesystem::deleteFileIfExists PHP 메소드

deleteFileIfExists() 공개 정적인 메소드

Deletes the given file if it exists.
public static deleteFileIfExists ( string $pathToFile ) : boolean
$pathToFile string
리턴 boolean true in case of success or if file does not exist, false otherwise. It might fail in case the file is not writeable.
    public static function deleteFileIfExists($pathToFile)
    {
        if (!file_exists($pathToFile)) {
            return true;
        }
        return @unlink($pathToFile);
    }

Usage Example

예제 #1
0
 private static function deleteIfLastModifiedBefore14August2014($path)
 {
     $modifiedTime = filemtime($path);
     if ($modifiedTime && $modifiedTime < 1408000000) {
         Filesystem::deleteFileIfExists($path);
     }
 }
All Usage Examples Of Piwik\Filesystem::deleteFileIfExists