PHP code example of 10quality / wp-file

1. Go to this page and download the library: Download 10quality/wp-file 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/ */

    

10quality / wp-file example snippets




$filename = __DIR__.'/myfile.txt';

$file = @fopen( $filename, ,'w+' );

$content = fread( $file );

fwrite( $file, $content );

fclose($file);

use TenQuality\WP\File;

$filename = __DIR__.'/myfile.txt';

$content = File::auth()->read( $filename );

File::auth()->write( $filename, $content );

File::auth( $url )->read( $filename );

// Returns bool
$isFile = File::auth()->is_file( $filename );
// Returns bool
$fileExists = File::auth()->exists( $filename );

$file = File::auth();

// Use is_dir to check if a path exists or not.
if ( $file->is_dir( $path ) )
    // Use mkdir to create non-existent paths.
    $file->mkdir( $path );
// Use rmdir to remove paths.
$file->rmdir( $path );