\think\testsTestFileHandle

Session 文件驱动

Summary

Methods
Properties
Constants
__construct()
gc()
read()
write()
delete()
No public properties found
No constants found
init()
findFiles()
getFileName()
writeFile()
readFile()
$config
N/A
unlink()
No private properties found
N/A

Properties

$config

$config

Methods

__construct()

__construct(\think\App  $app, array  $config = []) : mixed

Parameters

\think\App $app
array $config

Returns

mixed —

gc()

gc() : void

Session 垃圾回收

read()

read(string  $sessID) : string

读取Session

Parameters

string $sessID

Returns

string —

write()

write(string  $sessID, string  $sessData) : bool

写入Session

Parameters

string $sessID
string $sessData

Returns

bool —

delete()

delete(string  $sessID) : bool

删除Session

Parameters

string $sessID

Returns

bool —

init()

init() : void

打开Session

Throws

\Exception

findFiles()

findFiles(string  $root, \Closure  $filter) : \Generator

查找文件

Parameters

string $root
\Closure $filter

Returns

\Generator —

getFileName()

getFileName(string  $name, bool  $auto = false) : string

取得变量的存储文件名

Parameters

string $name

缓存变量名

bool $auto

是否自动创建目录

Returns

string —

writeFile()

writeFile(mixed  $path, mixed  $content) : bool

写文件(加锁)

Parameters

mixed $path
mixed $content

Returns

bool —

readFile()

readFile( $path) : string

读取文件内容(加锁)

Parameters

$path

Returns

string —

unlink()

unlink(string  $file) : bool

判断文件是否存在后,删除

Parameters

string $file

Returns

bool —