Skip to content

Commit

Permalink
还原rpc\File
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Apr 29, 2021
1 parent e2e3725 commit df78b1f
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/rpc/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,15 @@

class File extends \think\File
{
protected $persistent = false;

/**
* 持久化该文件
*/
public function persists()
{
$this->persistent = true;
}

public function __destruct()
{
//销毁时删除临时文件
if ($this->persistent) {
try {
if (file_exists($this->getPathname())) {
unlink($this->getPathname());
}
} catch (Throwable $e) {

try {
if (file_exists($this->getPathname())) {
unlink($this->getPathname());
}
} catch (Throwable $e) {

}
}
}

0 comments on commit df78b1f

Please sign in to comment.