Nette\Utils\FileSystem::createDir PHP Method

createDir() public static method

Creates a directory.
public static createDir ( $dir, $mode = 511 ) : void
return void
    public static function createDir($dir, $mode = 0777)
    {
        if (!is_dir($dir) && !@mkdir($dir, $mode, TRUE) && !is_dir($dir)) {
            // @ - dir may already exist
            throw new Nette\IOException("Unable to create directory '{$dir}'. " . error_get_last()['message']);
        }
    }

Usage Example

Esempio n. 1
1
 /**
  * backup single database table to file
  *
  * @param string $table
  * @param string $path
  */
 public function backupTableToFile(string $table, string $path)
 {
     $sql = $this->getHeader();
     $sql .= $this->backupTable($table);
     FileSystem::createDir($path);
     $path .= '/' . $table . '_' . date('Y-m-d_H-i-s') . '.sql';
     FileSystem::write($path, $sql);
 }
All Usage Examples Of Nette\Utils\FileSystem::createDir