File.php 341 B

123456789101112131415161718192021
  1. <?php
  2. namespace think\swoole\rpc;
  3. use Throwable;
  4. class File extends \think\File
  5. {
  6. public function __destruct()
  7. {
  8. //销毁时删除临时文件
  9. try {
  10. if (file_exists($this->getPathname())) {
  11. unlink($this->getPathname());
  12. }
  13. } catch (Throwable $e) {
  14. }
  15. }
  16. }