dmromanov/cakephp-tmpfile

CakePHP 的临时文件插件。

安装: 134

依赖关系: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

类型:cakephp-plugin

1.1.0 2021-10-10 17:29 UTC

This package is auto-updated.

Last update: 2024-09-11 00:11:59 UTC


README

Latest Stable Version Minimum PHP Version Build Status codecov

此插件提供用于创建临时文件的类,这些文件在程序终止后将被删除,并且与 CakePHP\Filesystem\File API 兼容。

使用方法

创建唯一的临时文件

$tmpFile1 = new TmpFile();
$tmpFile2 = new TmpFile(
    'foo-',
    TMP . 'bar',
    0644
)
$tmpFile2->close();

// use as a regular CakePHP\Filesystem\File
$tmpfile->open()
$tmpfile->write($data);
$tmpfile->close();

程序终止后(无论是正常终止还是崩溃后),文件将被删除。

构造函数参数

string $prefix The prefix of the generated temporary filename.
string $path The directory where the temporary filename will be created
int $mode File permissions

安装

您可以使用 composer 将此插件安装到您的 CakePHP 应用程序中。

安装 composer 包的推荐方法是

composer require dmromanov/cakephp-tmpfile