doubishi8303
2013-07-22 06:23
浏览 39
已采纳

php为具有unicode名称的文件创建zip文件

In my php app I did the following:

$dn = sys_get_temp_dir() . '/' . uniqid('td', false);
if (mkdir($dn) === true)
{
    $fn = $dn . '/' . '関連事業調査.xls';
    $writer = new \PHPExcel_Writer_Excel5($wb);
    $writer->save($fn);

    $fzip = sys_get_temp_dir() . '/' . uniqid('td', false) . '.zip';
    $password = $this->container->getParameter('ZipPassword');
    $out = null; 
    $ret = null;
    exec("zip -qjP $password $fzip $dn" . '/*', &$out, &$ret);
}

In linux environment it correctly creates zip file with given password. I can unzip the files in Linux without any problem. But if I download it to Windows, and extract the files, file names become incorrect. How to solve this problem?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题