PHP code example of walnut / lib_fileaccessor

1. Go to this page and download the library: Download walnut/lib_fileaccessor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

walnut / lib_fileaccessor example snippets


$fileAccessor = new PhpFileAccessor;
$fileName = 'test.txt';
$content = 'Test content.';

$fileAccessor->fileExists($fileName); //false

$fileAccessor->writeToFile($fileName, $content);
$fileAccessor->fileExists($fileName); //true

$fileAccessor->readFromFile($fileName)); //Test content.
$fileAccessor->removeFile($fileName);
$fileAccessor->fileExists($fileName); //false