PHP code example of tltemplates / txtfile

1. Go to this page and download the library: Download tltemplates/txtfile 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/ */

    

tltemplates / txtfile example snippets


//access the file
$file = new TxtFile('text.txt'); 
//access the file and create if it does not exist
$file = new TxtFile('text.txt', true); 

//store result in an array
$array = $file->readAllAsArray();
//store result in a string
$content = $file->readAllAsString();