Advertisement
asimryu

한글명 파일 다운로드할 때파일명이 깨질 때

Jun 20th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. //한글명 파일 다운로드할 때파일명이 깨질 때
  2. $filename = '한글파일명';
  3. $ie = isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false);
  4. if($ie) {
  5. // UTF-8에서 EUC-KR로 캐릭터셋 변경
  6. $filename = iconv('utf-8', 'euc-kr', $filename);
  7. // IE인 경우 헤더 변경
  8. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  9. header('Pragma: public');
  10. }else{
  11. // IE가 아닌 경우 일반 헤더 적용
  12. header("Cache-Control: no-cache, must-revalidate");
  13. header('Pragma: no-cache');
  14. }
  15.  
  16. 출처 : http://blog.freezner.com/archives/737
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement