phpÎļþÏÂÔØÖÐjpgÎļþΪ¿ÕÎļþµÄÎÊÌâ
Ç°Ò»¶Îʱ¼ä´ÖÂÔµÄѧϰÁËÒ»µãphpµÄ¶«Î÷£¬Õâ´Î¹«Ë¾µÄbugfree¸½¼þÏÂÔØ´ò¿ªÊ±Óöµ½Ð©ÎÊÌ⣬ÎÊÌâÖ¢×´ÈçÏ£º
jpg¸ñʽµÄÎļþ£¬µã»÷ÔÚä¯ÀÀÆ÷Öдò¿ªÏÔʾΪºì²æ
´úÂëÈçÏ£º
$FileType = "image/pjpeg"; header("Content-type: {$FileType}"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); $file_content = file_get_contents($FilePath); echo $file_content; exit;
Ê×ÏÈÅŲé³õʼÎļþÊÇ·ñÓÐÎÊÌâ
1¡¢echo $FilePath;
2¡¢¸ù¾ÝÊä³öµÄÎļþÍêÕû·¾¶£¬´ò¿ªÎļþ£¬Ã»ÓÐÎÊÌâ
ÅųýÔʼÎļþµÄÏÓÒÉ
È»ºóÅŲéÔÚÎļþ¶ÁÈ¡¹ý³ÌÖÐÊÇ·ñ´æÔÚÎÊÌâ
1¡¢$FileType = "application/jpeg";
header("Content-Disposition: attachment; filename=\"{$HeaderName}\";");
½«ÎļþÇ¿ÖÆÏÂÔØ
ÏÂÔØÏÂÀ´·¢ÏÖÎļþ´óСÓëÔʼÎļþÒ»Ö£¬µ«ÊÇ´ò¿ªºó»¹ÊÇΪ¿Õ£¬¿ÉÒÔÈ·¶¨ÔÚÎļþÊä³öµÄʱºò³öÏÖÁËÎÊÌâ
ʹÓÃfile_put_contents("d:\aaa.jpg",file_get_contents($FilePath))£¬½«Îļþ±£´æµ½·þÎñÆ÷£¬±£´æµÄÎļþ¿ÉÒÔ´ò¿ª
ÕâʱÎÒ»³ÒÉÔÚÎļþÊä³öµ½¿Í»§¶ËµÄʱºò±àÂë³öÁËÎÊÌâ
¾¹ýÒ»¶Îʱ¼äµÄÕÛÌÚ£¬ÖÕÓÚ°ÑÎÊÌâ½â¾ö£¬´úÂëÈçÏ£º
header("Content-type: {$FileType}"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Pragma: public"); //´Ë´¦Ôö¼Ó±àÂëÉ趨 header('Content-Transfer-Encoding: binary'); //´Ë´¦×îÖØÒª£¬Ä¿µÄÊÇÒªÇå¿ÕÊä³öµÄ×Ö½Ú ob_clean(); //´Ë´¦µÈÓÚÏÂÃæ±»×¢ÉäµÄÁ½ÐУ¬¿É½ÚÊ¡´úÂë readfile($FilePath); //$file_content = file_get_contents($FilePath); //echo $file_content; exit;
´Ë´¦¸½ob_clean()µÄ½âÊÍ£º
Clean (erase) the output buffer
ÎÒÀí½âob_clean()µÈÓÚ.netÖеÄResponse.Clear();
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ