using zipArchive addFile() will not add image to zip

后端 未结 4 1025
迷失自我
迷失自我 2021-01-04 14:01

I\'ve been at this for a while. This actually worked one time, then never again. it simply does not create the zip file. The file does exist.

$zip = new          


        
4条回答
  •  误落风尘
    2021-01-04 14:34

    The ZipArchive::addFile() method accepts the path to the file as its first parameter.


    Here, you are using :

    $zip->addFile("/trash-icon.png", "/gabage.png");
    

    Which means you are trying to add the /trash-icon.png file to your archive.


    Are you sure this file exists ?

    Note there is a / at the beginning of that file's path, which indicates it's an absolute path.
    Maybe that / should be removed, to use a relative path ?

提交回复
热议问题