下载代码怎么写
我写的代码下载下来的word文档是乱码,怎么看word文档是什么编码???求指点

解决方案 »

  1.   

    /**
     * @author wuq
     * 
     */
    function productDownLoad()
    {
    $talent_id = $_GET['talent_id'];
    $file  = $this->mod->getTalent($talent_id);
    $files = $file[0]['photo_url'];
    if($files)
    {
    $file = './photo/'.$files;
    if (file_exists($file)){  
        header('Content-Description: File Transfer');  
        header('Content-Type: application/octet-stream');  
        header('Content-Disposition: attachment; filename='.basename($file));  
        header('Content-Transfer-Encoding: binary');  
        header('Expires: 0');  
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');  
        header('Pragma: public');  
        header('Content-Length: ' . filesize($file));  
        ob_clean();  
        flush();  
        readfile($file);  
    }else{
    $this->success('下载失败[文件不存在 或文件已被损坏]',0,2);
    }
    }else{
    $this->jsAlert('管理员还没有上传附件!','');
    }
    }