Introduction
Providing some functions for managing files/directories
How to use
Import Fegg\Tool\File and create it with new.
Controller
<?php
namespace Site\Controller;
defined('FEGG_CORE_DIR') || exit;
use Fegg\Tool\File;
class Export extends Controller
{
public function index()
{
$file = new File();
$file->createDirectory(FEGG_SITE_DIR . '/data/export');
$file->writeFile(FEGG_SITE_DIR . '/data/export/list.csv', "id,title\n", 'w');
}
}
メモ
Most methods do nothing (no error, no return value) when the source file or directory does not exist. Check the result yourself, e.g. with file_exists(), when it matters.