0
처음에는 preg_replace가 파일 이름에 아랍어 문자를 읽지 않으므로 다운로드 할 때 .pdf 만 표시되므로 preg_replace에 아랍어 문자를 추가하여 파일 이름을 그대로 유지했습니다. 이제 파일 이름은 내 코드와 아무 잘못이preg_replace 및 file_get_contents가 아랍어 파일 이름을 읽지 않습니다
public function download($id){
$toReturn = study_material::where('id',$id)->first();
if(file_exists('uploads/material/'.$toReturn->material_file)){
$fileName = preg_replace('/[^أ-يa-zA-Z0-9-_\.]/','',$toReturn->material_title). "." .pathinfo($toReturn->material_file, PATHINFO_EXTENSION);
header("Content-Type: application/force-download");
header('Content-Type: text/html; charset=utf-8');
header("Content-Disposition: attachment; filename=" . $fileName);
echo file_get_contents('uploads/material/'.$toReturn->material_file);
}
exit;
}
그래서 'preg_replace'를'mb_ereg_replace'로 바꾸면 문제가 해결 될까요? 아니면 추가 단계가 필요합니까? –
나는 그것이 문제를 해결해야한다고 생각한다. – Sarmad