Making a temporary dir for unpacking a zipfile into

后端 未结 7 598
心在旅途
心在旅途 2020-12-29 23:05

I have a script that checks a zipfile containing a number of matching PDF+textfiles. I want to unpack, or somehow read the textfiles from the zipfile, and just pick out some

7条回答
  •  粉色の甜心
    2020-12-29 23:28

    There are a lot of overkill answers to this question. One simple answer would be:

    $tempdir = tempnam(sys_get_temp_dir()) . 'dir';
    mkdir($tempdir);
    
    1. Obtain a temporary file name.
    2. Create the directory (append a suffix to temp file, to avoid file name collision.)
    3. Done.

提交回复
热议问题