kohkimakimoto/temporary

用于操作临时文件的PHP辅助类。

v1.0.1 2015-07-29 04:03 UTC

This package is auto-updated.

Last update: 2024-09-07 00:17:26 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

用于操作临时文件和目录的PHP辅助类。

临时文件。

use Kohkimakimoto\Temporary\TemporaryFile;

$tmpfile = new TemporaryFile();

echo $tmpfile->path();  // ex) /private/var/folders/bt/xwh9qmcj00dctz53_rxclgtr0000gn/T/phpqWK5fj
$tmpfile->write("temporary data...");

echo $data = $tmpfile->read(); // temporary data...

// You don't need to close it. The temporary file will be closed automatically when the object removes.

临时目录。

use Kohkimakimoto\Temporary\TemporaryDir;

$tmpdir = new TemporaryDir();
echo $tmpdir->path();   // ex) /private/var/folders/bt/xwh9qmcj00dctz53_rxclgtr0000gn/T/KFHg4L

// You don't need to close it. The temporary dir will be deleted automatically when the object removes.

要求

  • PHP5.3或更高版本

安装

创建composer.json文件以通过composer安装。

{
    "require": {
        "kohkimakimoto/temporary": "1.0.*"
    }
}

运行composer install命令。

composer install

作者

Kohki Makimoto kohki.makimoto@gmail.com

许可证

MIT许可证。